home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / amiexpress / source / ae / code / acp3.00 / acp208.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-18  |  65.5 KB  |  2,339 lines

  1.  
  2. /*
  3.  * DH0:TPL/ACP.c
  4.  *
  5.  * MACHINE GENERATED
  6.  * Dec 03 1991 21:16:29
  7.  */
  8.  
  9. #include "aedefines.h"
  10. #include <exec/exec.h>
  11. #include <dos/dos.h>
  12. #include <dos/dosextens.h>
  13. #include <workbench/workbench.h>
  14. #include <workbench/startup.h>
  15. #include <graphics/gfx.h>
  16. #include <clib/icon_protos.h>
  17. #include <clib/dos_protos.h>
  18. #include <clib/exec_protos.h>
  19. #include <clib/intuition_protos.h>
  20. #include <clib/graphics_protos.h>
  21. #include "ACLVL.H"
  22. #include "Semis.h"
  23. #include "includes/date_protos.h"
  24. #include "includes/acpcycle_protos.h"
  25. #include "includes/IconInfo_protos.h"
  26. #include "includes/mymenus_protos.h"
  27. #include "includes/parse_protos.h"
  28. #include "includes/semis_protos.h"
  29. #include "includes/sercon_protos.h"
  30. #include "includes/StartProcess_protos.h"
  31. #include <stdio.h>
  32. #include <stdlib.h>
  33. #include <string.h>
  34. #include "ACP_defs208.h"
  35.  
  36. #define JH_CHATON 5
  37. #define JH_CHATOFF 4
  38. #define JH_QUIETON 7
  39. #define JH_QUIETOFF 6
  40. #define JH_AUTOCOMMAND 8
  41. int shorten=0;
  42. struct GadToolsBase *GadToolsBase=NULL;
  43. struct IntuitionBase *IntuitionBase=NULL;
  44. struct Library *IconBase;
  45. int atoileft(char str[]);
  46. struct Menu *EWinM=NULL;
  47. extern void do_appicon(struct MsgPort *myport);
  48. void Backup(char *str,int cycle);
  49. void Restrict(char *str);
  50. void ShowQuiet(int i);
  51. void LoadOldConfig(void);
  52. struct JHMessage
  53. {
  54.  struct Message Msg;
  55.   char String[200];
  56.   int Data;
  57.   int Command;
  58.   int NodeID;
  59.   int LineNum;
  60.   unsigned long signal;
  61.   struct Process *task;
  62.   APTR *Semi;
  63.   APTR Filler1;
  64.   APTR Filler2;
  65. };
  66. //struct JHMessage *Jhmsg;
  67. #define JH_UPDATE 1
  68. #define JH_DOWNLOAD 2
  69. #define JH_UPLOAD 3
  70. Prototype void    FreeGads(void);
  71. Prototype Gadget *InitGads(Screen *);
  72. Prototype void    drawborders(void);
  73. int QuietNode[10];
  74. ULONG BBSStack;
  75. char StartUpLocation[200];
  76. char PortName[]=  "AE.Master" ;
  77. #define SOPTLOOP for(i=p.ns;i<=p.ne;i++) if(Sopt[i]!=NULL)
  78. #define CMDLOOP for(i=p.ns;i<=p.ne;i++) if(Cmds[i]!=NULL)
  79. struct UserData {
  80.     char    Name[31],
  81.         Pass[9],
  82.         Location[30],
  83.         PhoneNumber[13];
  84.     USHORT    Slot_Number;
  85.     USHORT    Sec_Status,
  86.         Sec_Board,        /* File or Byte Ratio */
  87.         Sec_Library,        /* Ratio              */
  88.         Sec_Bulletin,        /* Computer Type      */
  89.         Messages_Posted;
  90.     ULONG    NewSinceDate,
  91.         ConfRead1,
  92.         ConfRead2,
  93.         ConfRead3,
  94.         ConfRead4,
  95.         ConfRead5,
  96.         ConfRead6,
  97.         ConfRead7,
  98.         ConfRead8,
  99.         ConfRead9;
  100.     char    Conference_Access[10];
  101.     USHORT    Uploads,
  102.         Downloads,
  103.         ConfRJoin,
  104.         Times_Called;
  105.     long    Time_Last_On,
  106.         Time_Used,
  107.         Time_Limit,
  108.         Time_Total;
  109.     ULONG    Bytes_Download,
  110.         Bytes_Upload,
  111.         Daily_Bytes_Limit,
  112.         Daily_Bytes_Dld;
  113.     char    Expert;
  114.     ULONG    ConfYM1,
  115.         ConfYM2,
  116.         ConfYM3,
  117.         ConfYM4,
  118.         ConfYM5,
  119.         ConfYM6,
  120.         ConfYM7,
  121.         ConfYM8,
  122.         ConfYM9;
  123.     long    BeginLogCall;
  124.     UBYTE    Protocol,
  125.             UUCPA,
  126.             LineLength,
  127.             New_User;
  128.     };
  129.  struct UserData User_Data = {
  130.     "User Name-------------------30",
  131.     "Pass---8",
  132.     "Location-------------------29",
  133.     "800-555-1212",
  134.     1,255,0,0,0,0,0,0,
  135.     0L,0L,0L,0L,0L,0L,0L,0L,
  136.     "X________",0,0,1,0,0L,0L,9600L,9600L,0L,1L,0L,0L,
  137.     'A',0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0,0,23,0
  138.     };
  139.  
  140.  
  141. struct ColorSpec ColorSpecs[] = 
  142.  { 
  143.    { 0,0,0,0 },
  144.    { 1,0xf,0x0,0x0 },
  145.    { 2,0x0,0xf,0x0 },
  146.    { 3,0xf,0xf,0x0 },
  147.    { 4,0x0,0x0,0xf },
  148.    { 5,0xf,0x0,0xf },
  149.    { 6,0x0,0xf,0xf },
  150.    { 7,0xf,0xf,0xf },
  151.    { -1,0,0,0 } };
  152. struct ColorSpec AmigaSpecs[] = 
  153.  { 
  154.    { 0,0,0,0 },
  155.    { 1,0xf,0xf,0xf },
  156.    { 2,0x0,0xf,0x0 },
  157.    { 3,0xf,0xf,0x0 },
  158.    { 4,0x0,0x0,0xf },
  159.    { 5,0xf,0x0,0xf },
  160.    { 6,0x0,0xf,0xf },
  161.    { 7,0xf,0x0,0x0 },
  162.    { -1,0,0,0 } };
  163. struct ColorSpec *Colors;
  164. struct UserKeys {
  165.     char    UserName[31];
  166.     long    Number;
  167.     UBYTE New_User;
  168.     char    Pad[19];
  169.     };
  170.  struct UserKeys User_Keys = {
  171.     "User Name-------------------30",
  172.     0L,0,"Padding---------19"
  173.     };
  174.  
  175. int Nodes[11];
  176. int suspend[11];
  177. int ShowAbout=0;
  178. int EdgeX,EdgeY;
  179. int Width=0,Height=0;
  180. int Theight=0;
  181. int DrawPen = 1; 
  182. int Chat[11];  /*** Default color for nonchat ***/
  183. int TChat[11];
  184. int ActiveNodes=0;
  185. void strlim(char *,char *,int);
  186. void LoadOldConfig(void);
  187. #define NODECONFIG 1
  188. #define RUNMCP 2
  189. #define LAST_UPLOADS 1
  190. #define LAST_DOWNLOADS 2
  191. #define LAST_CALLERS 0
  192. int TopOption=0;
  193. void GetCmds(int i);
  194. Prototype Gadget *Gad_Node_0;
  195. Prototype Gadget *Gad_Node_1;
  196. Prototype Gadget *Gad_Node_2;
  197. Prototype Gadget *Gad_Node_3;
  198. Prototype Gadget *Gad_Node_4;
  199. Prototype Gadget *Gad_Node_5;
  200. Prototype Gadget *Gad_Node_6;
  201. Prototype Gadget *Gad_Node_7;
  202. Prototype Gadget *Gad_Node_8;
  203. Prototype Gadget *Gad_Node_9;
  204. Prototype Gadget *Gad_Action;
  205. Prototype Gadget *Gad_User;
  206. Prototype Gadget *Gad_Location;
  207. Prototype Gadget *Gad_ExitNode;
  208. Prototype Gadget *Gad_NodeOffHook;
  209. Prototype Gadget *Gad_InstantLogin;
  210. Prototype Gadget *Gad_AEShell;
  211. Prototype Gadget *Gad_ToggleChat;
  212. Prototype Gadget *Gad_SysopLogin;
  213. Prototype Gadget *Gad_NRAMS;
  214. Prototype Gadget *Gad_ReserveNode;
  215. Prototype Gadget *Gad_Accounts;
  216. Prototype Gadget *Gad_InitModem;
  217. Prototype Gadget *Gad_LocalLogin;
  218. Prototype Gadget *Gad_MCP;
  219. Prototype Gadget *Gad_NodeConfig;
  220. Prototype Gadget *Gad_NodeChat;
  221. Prototype Gadget *Gad_SaveWin;
  222. Prototype Gadget *Gad_Control;
  223. Prototype Gadget *Gad_Tops;
  224. Prototype Gadget *Gad_TopsBox;
  225. Prototype Gadget *Gad_Short;
  226. Prototype List   List_Tops;
  227.  
  228. Prototype NewGadget NGAry[34];
  229. Prototype Gadget    *EGList;
  230. Prototype Window    *EWin;
  231. Prototype Window    *CWin;
  232. Prototype struct    VisualInfo *VisInfo;
  233. struct    VisualInfo *VisInfo;
  234. Window    *EWin=NULL;
  235. struct Commands {
  236.     UBYTE    AcLvl[100],
  237.         SerDevUnit;
  238.     char    SerDev[40],
  239.         NEW_UserPW[15];
  240.     long    OpeningBaud;
  241.     BYTE    TaskPri;
  242.     char    ConfName[9][60],
  243.         ConfLoc[9][60],
  244.         BBSName[41],
  245.         BBSLoc[41],
  246.         SysopName[41];
  247.     UBYTE    PSAcLvl[6],
  248.         PSRType[6],
  249.         PSRatio[6];
  250.     long    PSDBytes[6],
  251.         PSTime[6];
  252.     char    PSCnfAc[6][10],
  253.         MInit[101],
  254.         MReset[31],
  255.         MRing[31],
  256.         MAnswer[31],
  257.         MC300[31],
  258.         MC1200[31],
  259.         MC2400[31],
  260.         MC4800[31],
  261.         MC9600[31],
  262.         MC19200[31];
  263.     short    NumConf;
  264.     char    SysPass[31],
  265.         RemotePass[31];
  266.     USHORT    BaudTimes[10];
  267.     char    Pad[18];
  268.     };
  269. int BM[20];
  270. struct StartOption
  271. {
  272.   SHORT LeftEdge;
  273.   SHORT TopEdge;
  274.   SHORT Width;
  275.   SHORT Height;
  276.   int BitPlanes;
  277.   BOOL StatBar;
  278.   BOOL Interlace;
  279.   BOOL DupeCheck;
  280.   BOOL QLogon;
  281.   BOOL TakeCredits;
  282.   BOOL SeenIt;
  283.   BOOL TrapDoor;
  284.   BOOL Iconify;
  285.   BOOL RadBoogie;
  286.   BOOL A2232;
  287.   BOOL Toggles[20];
  288.   char Logoff[80];
  289.   char ShutDown[80];
  290.   char CycleLock[80];
  291.   char RamPen[80];
  292.   char BBSConfig[80];
  293.   char FilesNot[80];
  294.   char UserData[80];
  295.   char UserKey[80];
  296.   char OffHook[80];
  297.   char PubScreen[80];
  298.   APTR MasterSemi;
  299.   APTR SingleSemi;
  300. };
  301.  
  302. struct BUTTON
  303. {
  304.   char Text[100];
  305.   char Command[100];
  306.   BOOL Type;
  307. } Buttons[20];
  308.  
  309. struct Commands *Cmds[11];
  310. struct StartOption *Sopt[11];
  311. char ValError[100];
  312. int Validate(void);
  313. int TLock(char *str);
  314. void strleft(char *str,char *str1);
  315. #define VALERROR  else { strcpy(ValError,temp); return(0); }
  316. #define FILEERROR { strcpy(ValError,temp); return(0); }
  317.  
  318. struct NewMenu *EWinMenu;
  319.  
  320. int Button=FALSE;
  321. int ButtonID=-1; /**** Nutton to be processed when Node Button is selected*/
  322. BOOL ShortUp=FALSE;
  323. UBYTE SetOriText[15][100];/** Original Text for 15 control buttons **/
  324.  
  325. struct ACPMessage
  326. {
  327.   struct Message Msg;
  328.   char User[50];
  329.   char Location[50];
  330.   char Action[50];
  331.   char Baud[10];
  332.   int Data;
  333.   int Command;
  334.   int Node;
  335.   int LineNum;
  336.   struct Commands *Cmds;
  337.   struct StartOption *Sopt;
  338. } *msg,*cpymsg;
  339.  
  340. long signals=NULL;
  341. char mybbslocation[40];
  342. struct MsgPort *mp;
  343. struct GfxBase *GfxBase=NULL;
  344. BOOL ACPError=FALSE;
  345. void OpenMaster(void); /*** Opens Intereface to AmiExpress ***/
  346. void ShutDownMaster(void); /*** Closes Interface to AmiExpress ***/
  347. void HandleEditGadget(IMsg *im,short ig); /** HandleRoutine for control gadgets ***/
  348. void CallNode(int node,int); /** Send message to AEServer port for specific node ***/
  349. void UpdateNode(char *name,char *location,char *action,char *baud,int node);
  350. int CheckConfigNode(char str[]);
  351.  
  352. void ShowNodes(void); /** shows users on nodes every refresh **/
  353. void ClearUsers(void);/** Initialize various variables **/
  354. void LoadScreen(void);/** load coordinates for screen when powering up **/
  355. void ScreenSave(void);/** Save window coordinates **/
  356. void ReadStartUp(char *s); /** Read ACP.Startup from the S: directory **/
  357. void DoControl(int node); /** Implement gadgets **/
  358. void CheckMasterSig(long signals); /** Check for signal from nodes **/
  359. void sr(char *str); /** Strips ascii values less than 33 from trailing strings **/
  360. void SetTheGads(void); /** Set default text for the gadgets **/
  361. void DoButton(int B,int node); /** Do Custom buttons or nuttons **/
  362. void ToggleGads(); /** Toggle 15 control gadgets between custom gadgets **/ 
  363.  
  364. int Control = 0; /** Control Button to process **/
  365. int Short=0;/** Set Short screen to off **/
  366.  
  367. char Blank[]=  "                                                                    ";
  368.  
  369. struct User
  370. {
  371.   char User[50];
  372.   char Location[50];
  373.   char Action[50];
  374.   char Baud[10];
  375.   int Active;
  376.   int action;
  377. };
  378.  
  379. struct User Users[10]; /*** structure to hold node info for each node ***/
  380.  
  381. NewGadget NGAry[34] = {
  382.  
  383.    {
  384.     GLEF_SysopLogin, GTOP_SysopLogin, GWID_SysopLogin, GHEI_SysopLogin,
  385.     "Sysop Login",        /* UBYTE    *ng_GadgetText    */
  386.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  387.     GAD_SysopLogin,    /* UWORD    ng_GadgetID    */
  388.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  389.     NULPTR,        /* APTR      ng_VisualInfo    */
  390.     NULPTR,        /* APTR      ng_UserData    */
  391.   },
  392.   {
  393.     GLEF_InstantLogin, GTOP_InstantLogin, GWID_InstantLogin, GHEI_InstantLogin,
  394.     "Instant Login",        /* UBYTE    *ng_GadgetText    */
  395.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  396.     GAD_InstantLogin,    /* UWORD    ng_GadgetID    */
  397.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  398.     NULPTR,        /* APTR      ng_VisualInfo    */
  399.     NULPTR,        /* APTR      ng_UserData    */
  400.   },
  401. {
  402.     GLEF_AEShell, GTOP_AEShell, GWID_AEShell, GHEI_AEShell,
  403.     "AEShell",        /* UBYTE    *ng_GadgetText    */
  404.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  405.     GAD_AEShell,    /* UWORD    ng_GadgetID    */
  406.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  407.     NULPTR,        /* APTR      ng_VisualInfo    */
  408.     NULPTR,        /* APTR      ng_UserData    */
  409.   },
  410.  {
  411.     GLEF_ToggleChat, GTOP_ToggleChat, GWID_ToggleChat, GHEI_ToggleChat,
  412.     "Toggle Chat",        /* UBYTE    *ng_GadgetText    */
  413.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  414.     GAD_ToggleChat,    /* UWORD    ng_GadgetID    */
  415.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  416.     NULPTR,        /* APTR      ng_VisualInfo    */
  417.     NULPTR,        /* APTR      ng_UserData    */
  418.   },
  419. {
  420.     GLEF_ExitNode, GTOP_ExitNode, GWID_ExitNode, GHEI_ExitNode,
  421.     "Exit Node",        /* UBYTE    *ng_GadgetText    */
  422.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  423.     GAD_ExitNode,    /* UWORD    ng_GadgetID    */
  424.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  425.     NULPTR,        /* APTR      ng_VisualInfo    */
  426.     NULPTR,        /* APTR      ng_UserData    */
  427.   },
  428. {
  429.     GLEF_LocalLogin, GTOP_LocalLogin, GWID_LocalLogin, GHEI_LocalLogin,
  430.     "Local Login",        /* UBYTE    *ng_GadgetText    */
  431.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  432.     GAD_LocalLogin,    /* UWORD    ng_GadgetID    */
  433.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  434.     NULPTR,        /* APTR      ng_VisualInfo    */
  435.     NULPTR,        /* APTR      ng_UserData    */
  436.   },
  437. {
  438.     GLEF_ReserveNode, GTOP_ReserveNode, GWID_ReserveNode, GHEI_ReserveNode,
  439.     "Reserve Node",        /* UBYTE    *ng_GadgetText    */
  440.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  441.     GAD_ReserveNode,    /* UWORD    ng_GadgetID    */
  442.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  443.     NULPTR,        /* APTR      ng_VisualInfo    */
  444.     NULPTR,        /* APTR      ng_UserData    */
  445.   },
  446.   
  447. {
  448.     GLEF_Accounts, GTOP_Accounts, GWID_Accounts, GHEI_Accounts,
  449.     "Accounts",        /* UBYTE    *ng_GadgetText    */
  450.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  451.     GAD_Accounts,    /* UWORD    ng_GadgetID    */
  452.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  453.     NULPTR,        /* APTR      ng_VisualInfo    */
  454.     NULPTR,        /* APTR      ng_UserData    */
  455.   },
  456.   {
  457.     GLEF_InitModem, GTOP_InitModem, GWID_InitModem, GHEI_InitModem,
  458.     "Init Modem",        /* UBYTE    *ng_GadgetText    */
  459.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  460.     GAD_InitModem,    /* UWORD    ng_GadgetID    */
  461.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  462.     NULPTR,        /* APTR      ng_VisualInfo    */
  463.     NULPTR,        /* APTR      ng_UserData    */
  464.   },
  465.  {
  466.     GLEF_NodeOffHook, GTOP_NodeOffHook, GWID_NodeOffHook, GHEI_NodeOffHook,
  467.     "Node(offhook)",        /* UBYTE    *ng_GadgetText    */
  468.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  469.     GAD_NodeOffHook,    /* UWORD    ng_GadgetID    */
  470.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  471.     NULPTR,        /* APTR      ng_VisualInfo    */
  472.     NULPTR,        /* APTR      ng_UserData    */
  473.   },
  474.   {
  475.     GLEF_MCP, GTOP_MCP, GWID_MCP, GHEI_MCP,
  476.     "Quiet Node",        /* UBYTE    *ng_GadgetText    */
  477.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  478.     GAD_MCP,    /* UWORD    ng_GadgetID    */
  479.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  480.     NULPTR,        /* APTR      ng_VisualInfo    */
  481.     NULPTR,        /* APTR      ng_UserData    */
  482.   },
  483.   {
  484.     GLEF_NodeConfig, GTOP_NodeConfig, GWID_NodeConfig, GHEI_NodeConfig,
  485.     "Config Node",        /* UBYTE    *ng_GadgetText    */
  486.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  487.     GAD_NodeConfig,    /* UWORD    ng_GadgetID    */
  488.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  489.     NULPTR,        /* APTR      ng_VisualInfo    */
  490.     NULPTR,        /* APTR      ng_UserData    */
  491.   },
  492.   {
  493.     GLEF_NodeChat, GTOP_NodeChat, GWID_NodeChat, GHEI_NodeChat,
  494.     "Node Chat",        /* UBYTE    *ng_GadgetText    */
  495.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  496.     GAD_NodeChat,    /* UWORD    ng_GadgetID    */
  497.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  498.     NULPTR,        /* APTR      ng_VisualInfo    */
  499.     NULPTR,        /* APTR      ng_UserData    */
  500.   },
  501.   {
  502.     GLEF_SaveWin, GTOP_SaveWin, GWID_SaveWin, GHEI_SaveWin,
  503.     "Save Win",        /* UBYTE    *ng_GadgetText    */
  504.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  505.     GAD_SaveWin,    /* UWORD    ng_GadgetID    */
  506.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  507.     NULPTR,        /* APTR      ng_VisualInfo    */
  508.     NULPTR,        /* APTR      ng_UserData    */
  509.   },
  510. {
  511.     GLEF_NRAMS, GTOP_NRAMS, GWID_NRAMS, GHEI_NRAMS,
  512.     "Set NRAMS",        /* UBYTE    *ng_GadgetText    */
  513.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  514.     GAD_NRAMS,    /* UWORD    ng_GadgetID    */
  515.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  516.     NULPTR,        /* APTR      ng_VisualInfo    */
  517.     NULPTR,        /* APTR      ng_UserData    */
  518.   },
  519.   {
  520.     GLEF_Flip, GTOP_Flip, GWID_Flip, GHEI_Flip,
  521.     "X",
  522.     NULPTR,
  523.     GAD_Flip,
  524.     PLACETEXT_IN | NG_HIGHLABEL,
  525.     NULPTR,
  526.     NULPTR,
  527.   },
  528.   {
  529.     GLEF_Control, GTOP_Control, GWID_Control, GHEI_Control,
  530.     "Ami Express Master Control",        /* UBYTE    *ng_GadgetText    */
  531.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  532.     GAD_Control,    /* UWORD    ng_GadgetID    */
  533.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  534.     NULPTR,        /* APTR      ng_VisualInfo    */
  535.     NULPTR,        /* APTR      ng_UserData    */
  536.   },
  537.  {
  538.     GLEF_Action, GTOP_Action, GWID_Action, GHEI_Action,
  539.     "Action",        /* UBYTE    *ng_GadgetText    */
  540.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  541.     GAD_Action,    /* UWORD    ng_GadgetID    */
  542.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  543.     NULPTR,        /* APTR      ng_VisualInfo    */
  544.     NULPTR,        /* APTR      ng_UserData    */
  545.   },
  546.   {
  547.     GLEF_User, GTOP_User, GWID_User, GHEI_User,
  548.     "User",        /* UBYTE    *ng_GadgetText    */
  549.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  550.     GAD_User,    /* UWORD    ng_GadgetID    */
  551.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  552.     NULPTR,        /* APTR      ng_VisualInfo    */
  553.     NULPTR,        /* APTR      ng_UserData    */
  554.   },
  555.   {
  556.     GLEF_Location, GTOP_Location, GWID_Location, GHEI_Location,
  557.     "Location",        /* UBYTE    *ng_GadgetText    */
  558.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  559.     GAD_Location,    /* UWORD    ng_GadgetID    */
  560.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  561.     NULPTR,        /* APTR      ng_VisualInfo    */
  562.     NULPTR,        /* APTR      ng_UserData    */
  563.   },
  564.   {
  565.     GLEF_Baud, GTOP_Baud, GWID_Baud, GHEI_Baud,
  566.     "Baud",
  567.      NULPTR,
  568.      GAD_Baud,
  569.      PLACETEXT_IN | NG_HIGHLABEL,
  570.      NULPTR,
  571.      NULPTR,
  572.   },
  573.  
  574.   {
  575.     GLEF_Tops, GTOP_Tops, GWID_Tops, GHEI_Tops,
  576.     NULPTR,        /* UBYTE    *ng_GadgetText    */
  577.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  578.     GAD_Tops,    /* UWORD    ng_GadgetID    */
  579.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  580.     NULPTR,        /* APTR      ng_VisualInfo    */
  581.     NULPTR,        /* APTR      ng_UserData    */
  582.   },
  583.   {
  584.     BLEF_TopsBox, BTOP_TopsBox, BWID_TopsBox, BHEI_TopsBox,
  585.     NULPTR,        /* UBYTE    *ng_GadgetText    */
  586.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  587.     GAD_TopsBox,    /* UWORD    ng_GadgetID    */
  588.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  589.     NULPTR,        /* APTR      ng_VisualInfo    */
  590.     NULPTR,        /* APTR      ng_UserData    */
  591.   },
  592. {
  593.     GLEF_Short, GTOP_Short, GWID_Short, GHEI_Short,
  594.     "/X",        /* UBYTE    *ng_GadgetText    */
  595.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  596.     GAD_Short,    /* UWORD    ng_GadgetID    */
  597.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  598.     NULPTR,        /* APTR      ng_VisualInfo    */
  599.     NULPTR,        /* APTR      ng_UserData    */
  600.   },
  601.  {
  602.     GLEF_0, GTOP_0, GWID_0, GHEI_0,
  603.     "Node 0",        /* UBYTE    *ng_GadgetText    */
  604.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  605.     GAD_Node_0,    /* UWORD    ng_GadgetID    */
  606.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  607.     NULPTR,        /* APTR      ng_VisualInfo    */
  608.     NULPTR,        /* APTR      ng_UserData    */
  609.   },
  610.   {
  611.     GLEF_1, GTOP_1, GWID_1, GHEI_1,
  612.     "Node 1",        /* UBYTE    *ng_GadgetText    */
  613.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  614.     GAD_Node_1,    /* UWORD    ng_GadgetID    */
  615.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  616.     NULPTR,        /* APTR      ng_VisualInfo    */
  617.     NULPTR,        /* APTR      ng_UserData    */
  618.   },
  619.   {
  620.     GLEF_2, GTOP_2, GWID_2, GHEI_2,
  621.     "Node 2",        /* UBYTE    *ng_GadgetText    */
  622.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  623.     GAD_Node_2,    /* UWORD    ng_GadgetID    */
  624.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  625.     NULPTR,        /* APTR      ng_VisualInfo    */
  626.     NULPTR,        /* APTR      ng_UserData    */
  627.   },
  628.   {
  629.     GLEF_3, GTOP_3, GWID_3, GHEI_3,
  630.     "Node 3",        /* UBYTE    *ng_GadgetText    */
  631.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  632.     GAD_Node_3,    /* UWORD    ng_GadgetID    */
  633.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  634.     NULPTR,        /* APTR      ng_VisualInfo    */
  635.     NULPTR,        /* APTR      ng_UserData    */
  636.   },
  637.   {
  638.     GLEF_4, GTOP_4, GWID_4, GHEI_4,
  639.     "Node 4",        /* UBYTE    *ng_GadgetText    */
  640.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  641.     GAD_Node_4,    /* UWORD    ng_GadgetID    */
  642.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  643.     NULPTR,        /* APTR      ng_VisualInfo    */
  644.     NULPTR,        /* APTR      ng_UserData    */
  645.   },
  646.   {
  647.     GLEF_5, GTOP_5, GWID_5, GHEI_5,
  648.     "Node 5",        /* UBYTE    *ng_GadgetText    */
  649.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  650.     GAD_Node_5,    /* UWORD    ng_GadgetID    */
  651.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  652.     NULPTR,        /* APTR      ng_VisualInfo    */
  653.     NULPTR,        /* APTR      ng_UserData    */
  654.   },
  655.   {
  656.     GLEF_6, GTOP_6, GWID_6, GHEI_6,
  657.     "Node 6",        /* UBYTE    *ng_GadgetText    */
  658.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  659.     GAD_Node_6,    /* UWORD    ng_GadgetID    */
  660.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  661.     NULPTR,        /* APTR      ng_VisualInfo    */
  662.     NULPTR,        /* APTR      ng_UserData    */
  663.   },
  664.   {
  665.     GLEF_7, GTOP_7, GWID_7, GHEI_7,
  666.     "Node 7",        /* UBYTE    *ng_GadgetText    */
  667.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  668.     GAD_Node_7,    /* UWORD    ng_GadgetID    */
  669.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  670.     NULPTR,        /* APTR      ng_VisualInfo    */
  671.     NULPTR,        /* APTR      ng_UserData    */
  672.   },
  673.   {
  674.     GLEF_8, GTOP_8, GWID_8, GHEI_8,
  675.     "Node 8",        /* UBYTE    *ng_GadgetText    */
  676.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  677.     GAD_Node_8,    /* UWORD    ng_GadgetID    */
  678.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  679.     NULPTR,        /* APTR      ng_VisualInfo    */
  680.     NULPTR,        /* APTR      ng_UserData    */
  681.   },
  682.   {
  683.     GLEF_9, GTOP_9, GWID_9, GHEI_9,
  684.     "Node 9",        /* UBYTE    *ng_GadgetText    */
  685.     NULPTR,        /* struct TextAttr *ng_TextAttr    */
  686.     GAD_Node_9,    /* UWORD    ng_GadgetID    */
  687.     PLACETEXT_IN | NG_HIGHLABEL,    /* ULONG    ng_Flags    */
  688.     NULPTR,        /* APTR      ng_VisualInfo    */
  689.     NULPTR,        /* APTR      ng_UserData    */
  690.   },
  691. };
  692.  
  693. Gadget *Gad_Node_0;
  694.  
  695. Gadget *Gad_Node_1;
  696.  
  697. Gadget *Gad_Node_2;
  698.  
  699. Gadget *Gad_Node_3;
  700.  
  701. Gadget *Gad_Node_4;
  702.  
  703. Gadget *Gad_Node_5;
  704.  
  705. Gadget *Gad_Node_6;
  706.  
  707. Gadget *Gad_Node_7;
  708.  
  709. Gadget *Gad_Node_8;
  710.  
  711. Gadget *Gad_Node_9;
  712.  
  713. Gadget *Gad_Action;
  714.  
  715. Gadget *Gad_User;
  716.  
  717. Gadget *Gad_Location;
  718.  
  719. Gadget *Gad_Baud;
  720.  
  721. Gadget *Gad_ExitNode;
  722.  
  723. Gadget *Gad_NodeOffHook;
  724.  
  725. Gadget *Gad_InstantLogin;
  726.  
  727. Gadget *Gad_AEShell;
  728.  
  729. Gadget *Gad_ToggleChat;
  730.  
  731. Gadget *Gad_SysopLogin;
  732.  
  733. Gadget *Gad_NRAMS;
  734.  
  735. Gadget *Gad_ReserveNode;
  736.  
  737. Gadget *Gad_Accounts;
  738.  
  739. Gadget *Gad_InitModem;
  740.  
  741. Gadget *Gad_LocalLogin;
  742.  
  743. Gadget *Gad_MCP;
  744.  
  745. Gadget *Gad_NodeConfig;
  746.  
  747. Gadget *Gad_NodeChat;
  748.  
  749. Gadget *Gad_SaveWin;
  750.  
  751. Gadget *Gad_Flip;
  752.  
  753. Gadget *Gad_Control;
  754.  
  755. Gadget *Gad_Tops;
  756.  
  757. Gadget *Gad_TopsBox;
  758. Gadget *Gad_Short;
  759. char   *StatAry_Tops[] = {
  760.   "Last Five Callers",
  761.   "Last Five Uploads",
  762.   "Last Five Downloads",
  763.   
  764.   NULPTR
  765. };
  766. char **Ary_Tops    = StatAry_Tops;
  767.  
  768. Gadget *EGList;
  769.  
  770. /* ***** InitGads ***** */
  771. Gadget *
  772. InitGads(Scr)
  773.   Screen *Scr;
  774. {
  775.   Gadget *gad;
  776.   short i;
  777.   static BOOL again=FALSE;
  778.   NewGadget *ng;
  779.   EGList = NULPTR;
  780.   if(!again)
  781.   {
  782.     if ((VisInfo = GetVisualInfo(Scr, TAG_END)) == NULL)
  783.     return(NULPTR);
  784.  
  785.   for (i = 0, ng = NGAry;
  786.        i < sizeof(NGAry)/sizeof(NGAry[0]);
  787.        ++i, ++ng)
  788.   {
  789.     ng->ng_VisualInfo = VisInfo;
  790.     ng->ng_TextAttr   = Scr->Font;
  791.   }
  792.   }
  793.   if ((gad = CreateContext(&EGList)) == NULL)
  794.     return(NULPTR);
  795.   
  796.  
  797.   Gad_Action    = gad = 
  798.     CreateGadget(    TEXT_KIND, gad, NG_Action,
  799.     GTTX_Border,       2,
  800.     TAG_END);
  801.  
  802.   if (gad == NULL)
  803.     return(NULPTR);
  804.  
  805.   Gad_User    = gad = 
  806.     CreateGadget(    TEXT_KIND, gad, NG_User,
  807.     GTTX_Border,       2,
  808.     TAG_END);
  809.  
  810.   if (gad == NULL)
  811.     return(NULPTR);
  812.  
  813.   Gad_Location    = gad = 
  814.     CreateGadget(    TEXT_KIND, gad, NG_Location,
  815.     GTTX_Border,       2,
  816.     TAG_END);
  817.  
  818.   if (gad == NULL)
  819.     return(NULPTR);
  820.   
  821.   Gad_Baud = gad = 
  822.      CreateGadget(    TEXT_KIND, gad, NG_Baud,
  823.      GTTX_Border,       2,
  824.      TAG_END);
  825.   
  826.   if(gad==NULL)
  827.     return(NULPTR);
  828.  
  829.   if(!again)NGAry[GAD_ExitNode].ng_TopEdge +=-110+(Theight*11);
  830.   Gad_ExitNode    = gad = 
  831.     CreateGadget(  BUTTON_KIND, gad, NG_ExitNode, 
  832.     TAG_END);
  833.  
  834.   if (gad == NULL)
  835.     return(NULPTR);
  836.  
  837.   if(!again)NGAry[GAD_NodeOffHook].ng_TopEdge +=-110+(Theight*11);
  838.   Gad_NodeOffHook    = gad = 
  839.     CreateGadget(  BUTTON_KIND, gad, NG_NodeOffHook, 
  840.     TAG_END);
  841.  
  842.   if (gad == NULL)
  843.     return(NULPTR);
  844.  
  845.   if(!again)NGAry[GAD_InstantLogin].ng_TopEdge +=-110+(Theight*11);
  846.   Gad_InstantLogin    = gad = 
  847.     CreateGadget(  BUTTON_KIND, gad, NG_InstantLogin,
  848.     TAG_END);
  849.  
  850.   if (gad == NULL)
  851.     return(NULPTR);
  852.  
  853.   if(!again)NGAry[GAD_AEShell].ng_TopEdge +=-110+(Theight*11);
  854.   Gad_AEShell    = gad = 
  855.     CreateGadget(  BUTTON_KIND, gad, NG_AEShell, 
  856.     TAG_END);
  857.  
  858.   if (gad == NULL)
  859.     return(NULPTR);
  860.  
  861.   if(!again)NGAry[GAD_ToggleChat].ng_TopEdge +=-110+(Theight*11);
  862.   Gad_ToggleChat    = gad = 
  863.     CreateGadget(  BUTTON_KIND, gad, NG_ToggleChat,
  864.     TAG_END);
  865.  
  866.   if (gad == NULL)
  867.     return(NULPTR);
  868.  
  869.   if(!again)NGAry[GAD_SysopLogin].ng_TopEdge +=-110+(Theight*11);
  870.   Gad_SysopLogin    = gad = 
  871.     CreateGadget(  BUTTON_KIND, gad, NG_SysopLogin,
  872.     TAG_END);
  873.  
  874.   if (gad == NULL)
  875.     return(NULPTR);
  876.  
  877.   if(!again)NGAry[GAD_NRAMS].ng_TopEdge +=-110+(Theight*11);
  878.   Gad_NRAMS    = gad = 
  879.     CreateGadget(  BUTTON_KIND, gad, NG_NRAMS, 
  880.     TAG_END);
  881.  
  882.   if (gad == NULL)
  883.     return(NULPTR);
  884.  
  885.   if(!again)NGAry[GAD_ReserveNode].ng_TopEdge +=-110+(Theight*11);
  886.   Gad_ReserveNode    = gad = 
  887.     CreateGadget(  BUTTON_KIND, gad, NG_ReserveNode, 
  888.     TAG_END);
  889.  
  890.   if (gad == NULL)
  891.     return(NULPTR);
  892.  
  893.   if(!again)NGAry[GAD_Accounts].ng_TopEdge +=-110+(Theight*11);
  894.   Gad_Accounts    = gad = 
  895.     CreateGadget(  BUTTON_KIND, gad, NG_Accounts,
  896.     TAG_END);
  897.  
  898.   if (gad == NULL)
  899.     return(NULPTR);
  900.  
  901.   if(!again)NGAry[GAD_InitModem].ng_TopEdge +=-110+(Theight*11);
  902.   Gad_InitModem    = gad = 
  903.     CreateGadget(  BUTTON_KIND, gad, NG_InitModem, 
  904.     TAG_END);
  905.  
  906.   if (gad == NULL)
  907.     return(NULPTR);
  908.  
  909.   if(!again)NGAry[GAD_LocalLogin].ng_TopEdge +=-110+(Theight*11);
  910.   Gad_LocalLogin    = gad = 
  911.     CreateGadget(  BUTTON_KIND, gad, NG_LocalLogin,
  912.     TAG_END);
  913.  
  914.   if (gad == NULL)
  915.     return(NULPTR);
  916.  
  917.   if(!again)NGAry[GAD_MCP].ng_TopEdge +=-110+(Theight*11);
  918.   Gad_MCP    = gad =     CreateGadget(  BUTTON_KIND, gad, NG_MCP, 
  919.     TAG_END);
  920.  
  921.   if (gad == NULL)
  922.     return(NULPTR);
  923.  
  924.   if(!again)NGAry[GAD_NodeConfig].ng_TopEdge +=-110+(Theight*11);
  925.   Gad_NodeConfig    = gad =     CreateGadget(  BUTTON_KIND, gad, NG_NodeConfig, 
  926.     TAG_END);
  927.  
  928.   if (gad == NULL)
  929.     return(NULPTR);
  930.  
  931.   if(!again)NGAry[GAD_NodeChat].ng_TopEdge +=-110+(Theight*11);
  932.   Gad_NodeChat    = gad =     CreateGadget(  BUTTON_KIND, gad, NG_NodeChat,
  933.     TAG_END);
  934.  
  935.   if (gad == NULL)
  936.     return(NULPTR);
  937.  
  938.   if(!again)NGAry[GAD_SaveWin].ng_TopEdge +=-110+(Theight*11);
  939.   Gad_SaveWin    = gad =     CreateGadget(  BUTTON_KIND, gad, NG_SaveWin,
  940.     TAG_END);
  941.  
  942.   if (gad == NULL)
  943.     return(NULPTR);
  944.  
  945.   if(!again)NGAry[GAD_Flip].ng_TopEdge += -110+(Theight*11);
  946.    Gad_Flip= gad = CreateGadget( BUTTON_KIND, gad, NG_Flip,
  947.      GTTX_Border,       2,
  948.      TAG_END);
  949.  
  950.    if(gad ==NULL)
  951.      return(NULPTR);
  952.  
  953.   if(!again)NGAry[GAD_Control].ng_TopEdge +=-110+(Theight*11);
  954.   Gad_Control    = gad =     CreateGadget(    BUTTON_KIND, gad, NG_Control,
  955.     GTTX_Border,       2,
  956.     TAG_END);
  957.  
  958.   if (gad == NULL)
  959.     return(NULPTR);
  960.  
  961.   if(!again)NGAry[GAD_Tops].ng_TopEdge +=-110+(Theight*11);
  962.   Gad_Tops    = gad =     CreateGadget(   CYCLE_KIND, gad, NG_Tops,
  963.     GTCY_Labels,       Ary_Tops,
  964.     GTCY_Active,       TopOption,
  965.     TAG_END);
  966.  
  967.   if (gad == NULL)
  968.     return(NULPTR);
  969.  
  970.   if(!again)NGAry[GAD_TopsBox].ng_TopEdge +=-110+(Theight*11);
  971.   Gad_TopsBox    = gad =     CreateGadget(    BUTTON_KIND, gad, NG_TopsBox,
  972.     GTTX_Border,       2,
  973.     TAG_END);
  974.  
  975.   if (gad == NULL)
  976.     return(NULPTR);
  977.  
  978. Gad_Short    = gad =     CreateGadget(  BUTTON_KIND, gad, NG_Short,
  979.     TAG_END);
  980.  
  981.   if (gad == NULL)
  982.     return(NULL);
  983. if(Nodes[0])
  984.   {
  985.     Gad_Node_0    = gad = 
  986.     CreateGadget(  BUTTON_KIND, gad, NG_Node_0,
  987.     TAG_END);
  988.  
  989.   if (gad == NULL)
  990.     return(NULPTR);
  991.  
  992.   }
  993. if(Nodes[1])
  994. {
  995.   Gad_Node_1    = gad = 
  996.     CreateGadget(  BUTTON_KIND, gad, NG_Node_1,
  997.     TAG_END);
  998.  
  999.   if (gad == NULL)
  1000.     return(NULPTR);
  1001.  
  1002. }
  1003. if(Nodes[2])
  1004. {
  1005.   Gad_Node_2    = gad = 
  1006.     CreateGadget(  BUTTON_KIND, gad, NG_Node_2,
  1007.     TAG_END);
  1008.  
  1009.   if (gad == NULL)
  1010.     return(NULPTR);
  1011.  
  1012. }
  1013. if(Nodes[3])
  1014. {
  1015.   Gad_Node_3    = gad = 
  1016.     CreateGadget(  BUTTON_KIND, gad, NG_Node_3,
  1017.     TAG_END);
  1018.  
  1019.   if (gad == NULL)
  1020.     return(NULPTR);
  1021.  
  1022. }
  1023. if(Nodes[4])
  1024. {
  1025.   Gad_Node_4    = gad = 
  1026.     CreateGadget(  BUTTON_KIND, gad, NG_Node_4,
  1027.     TAG_END);
  1028.  
  1029.   if (gad == NULL)
  1030.     return(NULPTR);
  1031.  
  1032. }
  1033. if(Nodes[5])
  1034. {
  1035.   Gad_Node_5    = gad = 
  1036.     CreateGadget(  BUTTON_KIND, gad, NG_Node_5,
  1037.     TAG_END);
  1038.  
  1039.   if (gad == NULL)
  1040.     return(NULPTR);
  1041.  
  1042. }
  1043. if(Nodes[6])
  1044. {
  1045.   Gad_Node_6    = gad = 
  1046.     CreateGadget(  BUTTON_KIND, gad, NG_Node_6,
  1047.     TAG_END);
  1048.  
  1049.   if (gad == NULL)
  1050.     return(NULPTR);
  1051.  
  1052. }
  1053. if(Nodes[7])
  1054. {
  1055.   Gad_Node_7    = gad = 
  1056.     CreateGadget(  BUTTON_KIND, gad, NG_Node_7,
  1057.     TAG_END);
  1058.  
  1059.   if (gad == NULL)
  1060.     return(NULPTR);
  1061.  
  1062. }
  1063. if(Nodes[8])
  1064. {
  1065.   Gad_Node_8    = gad = 
  1066.     CreateGadget(  BUTTON_KIND, gad, NG_Node_8,
  1067.     TAG_END);
  1068.  
  1069.   if (gad == NULL)
  1070.     return(NULPTR);
  1071.  
  1072. }
  1073. if(Nodes[9])
  1074. {
  1075.   Gad_Node_9    = gad = 
  1076.     CreateGadget(  BUTTON_KIND, gad, NG_Node_9,
  1077.     TAG_END);
  1078.  
  1079.   if (gad == NULL)
  1080.     return(NULPTR);
  1081.  
  1082. }
  1083.  
  1084.   again=TRUE;
  1085.   return(EGList);
  1086. }
  1087. int ALine=0;
  1088. WORD DIM[5]= { 1,1,1,1 }; /*** Dimensions of ZIP window default ***/
  1089. WORD ZIM[3]= { 10,100 };
  1090. /*  main function to test gadgets  */
  1091. long MasterSig; /*** storage for our ports address ***/
  1092. Screen *Scr; /*** Pointer to our screen ***/
  1093. Gadget *gadgets;
  1094. char StartNode[11][80];/*** Node startup scripts ***/
  1095. BOOL NodeIdle[11];
  1096. BOOL StartUp=FALSE;/*** Set startup scripts to none ***/
  1097. BOOL ZipOn=FALSE;/*** Turn ZIPPED window off ***/ 
  1098. int notDone=1;
  1099. BOOL Down[11];
  1100. UBYTE PublicName[200];
  1101. UWORD Pens[9];
  1102. extern char *MyVerStr;
  1103. extern void myrequest(char *s);
  1104. struct MsgPort *myappport=NULL;
  1105. int DoMultiCom;
  1106. int
  1107. main(int argc, char *argv[])
  1108. {
  1109.   MenuItem *ALZMENU;
  1110.   MenuItem *ALZMENU2;
  1111.   
  1112.   BPTR olddir;
  1113.   struct WBStartup *argmsg;
  1114.   struct WBArg *wb_arg;
  1115.   struct AppMessage *appmsg;
  1116.   char IconStartName[200];
  1117.   LONG ktr;
  1118.   int newscreen=0;
  1119.   struct Screen *tempscreen;
  1120.   ULONG ScreenModeID;
  1121.   IMsg *im;
  1122.   int num;
  1123.   char Version[200];
  1124.   long WindowSig,myappsig; 
  1125.   int i;
  1126.   strcpy(mybbslocation,"");
  1127.   strcpy(PublicName,"");
  1128.   strcpy(StartUpLocation,"S:ACP.STARTUP");
  1129.   Colors=(struct ColorSpec *)&AmigaSpecs;
  1130.   Pens[DETAILPEN]=3;
  1131.   Pens[BLOCKPEN]=4;
  1132.   Pens[TEXTPEN]=6; 
  1133.   Pens[SHINEPEN]=1;
  1134.   Pens[SHADOWPEN]=0;
  1135.   Pens[FILLPEN]=4;
  1136.   Pens[FILLTEXTPEN]=3;
  1137.   Pens[BACKGROUNDPEN]=4;
  1138.   Pens[HIGHLIGHTTEXTPEN]=7;
  1139.   
  1140.  
  1141.   IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",0L);
  1142.   GadToolsBase=(struct GadToolsBase *)OpenLibrary("gadtools.library",0L);
  1143.   IconBase=OpenLibrary("icon.library",0L);
  1144.   GfxBase=(struct GfxBase *)OpenLibrary("graphics.library",0L);
  1145.  
  1146.  
  1147.   if(argc==0)
  1148.   {
  1149.     argmsg=(struct WBStartup *)argv;
  1150.     wb_arg=argmsg->sm_ArgList;
  1151.     for(ktr=0;ktr<argmsg->sm_NumArgs; ktr++,wb_arg++)
  1152.     {
  1153.       if(NULL!=wb_arg->wa_Lock)
  1154.       {  olddir=CurrentDir(wb_arg->wa_Lock); strcpy(IconStartName,wb_arg->wa_Name);
  1155.          CurrentDir(olddir);
  1156.       }
  1157.     }
  1158.   
  1159.   }
  1160.   else { strcpy(IconStartName,argv[0]); }
  1161.     for(i=0;i<10;i++)
  1162.     {  
  1163.       Chat[i]=1;
  1164.       Down[i]=FALSE;
  1165.       TChat[i]=0;
  1166.       Cmds[i]=NULL;
  1167.       Sopt[i]=NULL;
  1168.       Nodes[i]=0;
  1169.       QuietNode[i]=0;
  1170.     }
  1171.    
  1172.     if(!FindPort("AE.Master"))
  1173.     {
  1174.       OpenMaster();
  1175.       ClearUsers();
  1176.       InitCycles();
  1177.       DoMultiCom=0;
  1178.       ReadStartUp(IconStartName);
  1179.       
  1180.       if(ACPError)
  1181.       {
  1182.         ShutDownMaster();
  1183.         goto TheEnd;
  1184.       }
  1185.       if(!Validate())
  1186.       {
  1187.         ShutDownMaster();
  1188.         goto TheEnd;
  1189.       }
  1190.       Theight +=1;
  1191.       EdgeX=WLEF; EdgeY=WTOP; Width=WWID; Height=WHEI;
  1192.       Height +=-110 +(Theight*11);
  1193.       LoadScreen();
  1194.   
  1195.       msg=(struct ACPMessage *)AllocMem(sizeof(struct ACPMessage),MEMF_PUBLIC|MEMF_CLEAR);
  1196.       if(PublicName[0]=='\0') Scr=(Screen *)LockPubScreen(NULL);
  1197.       else
  1198.       {
  1199.         Scr=(Screen *)LockPubScreen(PublicName);
  1200.         if(Scr==NULL) 
  1201.         { 
  1202.           tempscreen=LockPubScreen(NULL);
  1203.           ScreenModeID=GetVPModeID(&(tempscreen->ViewPort));
  1204.           newscreen=1; 
  1205.           if(Colors!=(struct ColorSpec *)&AmigaSpecs)
  1206.           {
  1207.             Pens[SHINEPEN]=7;
  1208.           }
  1209.           Scr=OpenScreenTags(NULL,SA_Left,0,SA_Top,0,SA_Width,tempscreen->Width,SA_Height,tempscreen->Height,SA_Depth,3,
  1210.                         SA_Title,PublicName,SA_Colors,Colors,
  1211.                         SA_Pens,&Pens,SA_Type,PUBLICSCREEN,SA_PubName,PublicName,
  1212.                         SA_DisplayID,ScreenModeID,SA_Overscan,OSCAN_TEXT);
  1213.           UnlockPubScreen(NULL,tempscreen);
  1214.  
  1215.         }
  1216.       }
  1217.       if (Scr)
  1218.       {
  1219.  
  1220.         if(ZipOn) { i=DIM[2]; DIM[2]=Width; Width=i;
  1221.                 i=DIM[3]; DIM[3]=Height; Height=i;
  1222.                 i=DIM[0]; DIM[0]=EdgeX; EdgeX=i;
  1223.                 i=DIM[1]; DIM[1]=EdgeY; EdgeY=i; do_appicon(myappport);}
  1224.         if (gadgets = InitGads(Scr))
  1225.         {
  1226.           EWinM=CreateMenus(EWinMenu,GTMN_FrontPen,1,TAG_DONE);
  1227.  
  1228.           i=0;
  1229.           ALZMENU2=EWinM->FirstItem;  
  1230.           while (i++!=4) {
  1231.             ALZMENU=ALZMENU2->SubItem;
  1232.             while (ALZMENU) {
  1233.               ALZMENU->Flags=(ALZMENU->Flags|HIGHNONE);         
  1234.               ALZMENU=ALZMENU->NextItem;                        
  1235.             }
  1236.             ALZMENU2=ALZMENU2->NextItem;
  1237.           }
  1238.           sprintf(Version,"AmiExpress Server %s, by \"Joseph Hodge\"",MyVerStr);
  1239.           LayoutMenus(EWinM,VisInfo,TAG_DONE);
  1240.           EWin = (Window *)OpenWindowTags(NULL,
  1241.              WA_Flags,     WFLG_DRAGBAR|
  1242.                            WFLG_DEPTHGADGET|
  1243.                            WFLG_CLOSEGADGET|
  1244.                            WFLG_NOCAREREFRESH|
  1245.                            WFLG_SMART_REFRESH|
  1246.                            WFLG_REPORTMOUSE,
  1247.  
  1248.              WA_IDCMP,     LISTVIEWIDCMP|
  1249.                            IDCMP_NEWSIZE|
  1250.                            IDCMP_MENUPICK|
  1251.                            IDCMP_VANILLAKEY|
  1252.                            IDCMP_RAWKEY|
  1253.                            IDCMP_GADGETUP|
  1254.                            IDCMP_CLOSEWINDOW ,
  1255.              WA_Left,      EdgeX,
  1256.              WA_Top,       EdgeY,
  1257.              WA_DetailPen, !newscreen ? 1:4,
  1258.              WA_BlockPen,  !newscreen ? 2:Pens[HIGHLIGHTTEXTPEN],
  1259.              WA_Width,     Width,
  1260.              WA_Height,    Height,
  1261.              WA_Title,     Version,
  1262.              WA_MinWidth,  1,
  1263.              WA_MinHeight, 1,
  1264.              WA_MaxWidth,  ~0,
  1265.              WA_MaxHeight, ~0,
  1266.              WA_Zoom, (APTR)&DIM,
  1267.              WA_AutoAdjust, 1,
  1268.              WA_PubScreen, PublicName[0]=='\0' ? NULL:Scr,
  1269.              WA_PubScreenFallBack, 1,
  1270.              WA_Gadgets,   gadgets,
  1271.              TAG_END );
  1272.       
  1273.           SetMenuStrip(EWin,EWinM);
  1274.           SetTheGads();
  1275.           if(PublicName[0]=='\0')
  1276.           {
  1277.              UnlockPubScreen(NULL,Scr);
  1278.         
  1279.           }else PubScreenStatus(Scr,0L);
  1280.           if (EWin)
  1281.           {
  1282.             drawborders();
  1283.             notDone = 1;
  1284.         
  1285.             GT_RefreshWindow(EWin, NULL);
  1286.             WindowSig= (1L<< EWin->UserPort->mp_SigBit);
  1287.             MasterSig= (1L<< mp->mp_SigBit);
  1288.             myappsig=(1L<< myappport->mp_SigBit);
  1289.             if(StartUp)
  1290.             {
  1291.               for(i=0;i<10;i++)
  1292.               {
  1293.                 if(StartNode[i][0]!='\0')
  1294.                 {
  1295.                   SetAPen(EWin->RPort,TChat[i]);
  1296.                   Move(EWin->RPort,64,26+(i*11));
  1297.                   Draw(EWin->RPort,64,26+(i*11)+6);
  1298.                   Move(EWin->RPort,63,26+(i*11));
  1299.                   Draw(EWin->RPort,63,26+(i*11)+6);
  1300.                   Move(EWin->RPort,62,26+(i*11));
  1301.                   Draw(EWin->RPort,62,26+(i*11)+6);
  1302.                   Move(EWin->RPort,61,26+(i*11));
  1303.                   Draw(EWin->RPort,61,26+(i*11)+6); 
  1304.                   if(!NodeIdle[i]){
  1305.                     if(StartProcess(&StartNode[i][0],BBSStack)) ActiveNodes +=1;}
  1306.                 }
  1307.               }
  1308.             }
  1309.             while (notDone)
  1310.             {
  1311.               signals=Wait(MasterSig | WindowSig | myappsig);
  1312.               if(signals&WindowSig)
  1313.                 while (im = GT_GetIMsg(EWin->UserPort))
  1314.                 {
  1315.                   switch (im->Class)
  1316.                   {
  1317.                     case IDCMP_CLOSEWINDOW:
  1318.                          if(!ActiveNodes){ notDone=0; break; }
  1319.                     for(i=0;i<9;i++)
  1320.                     {
  1321.                       if(StartNode[i][0]!='\0')
  1322.                       {
  1323.                         if(Users[i].action==22 && !Down[i]) { Control=SV_NODEOFFHOOK;
  1324.                                              Down[i]=TRUE;DoControl(i);}
  1325.                       else if(Users[i].action!=24) notDone=1; 
  1326.                     }
  1327.                   }
  1328.                    
  1329.                  break;
  1330.                  
  1331.             case IDCMP_NEWSIZE:
  1332.               if(!shorten)
  1333.               do_appicon(myappport); shorten=0;
  1334.               GT_BeginRefresh(EWin);
  1335.               GT_EndRefresh(EWin, TRUE);
  1336.                 drawborders();
  1337.                 switch(TopOption)
  1338.                 {
  1339.                   case LAST_CALLERS:ShowLastUser(EWin);break;
  1340.                   case LAST_UPLOADS:ShowLastUploads(EWin);break;
  1341.                   case LAST_DOWNLOADS:ShowLastDownloads(EWin);break;
  1342.                 }
  1343.                 for(i=0;i<=9;i++)
  1344.                 {
  1345.                    if(StartNode[i][0]!='\0')
  1346.                    {
  1347.                     SetAPen(EWin->RPort,TChat[i]);
  1348.                     Move(EWin->RPort,64,26+(i*11));
  1349.                     Draw(EWin->RPort,64,26+(i*11)+6);
  1350.                     Move(EWin->RPort,63,26+(i*11));
  1351.                     Draw(EWin->RPort,63,26+(i*11)+6);
  1352.                     Move(EWin->RPort,62,26+(i*11));
  1353.                     Draw(EWin->RPort,62,26+(i*11)+6);
  1354.                     Move(EWin->RPort,61,26+(i*11));
  1355.                     Draw(EWin->RPort,61,26+(i*11)+6); 
  1356.                    }
  1357.                  }
  1358.                 ShowNodes();
  1359.               break;
  1360.             case GADGETDOWN:
  1361.             case GADGETUP:
  1362.                  HandleEditGadget(im,0); break;
  1363.             case MENUPICK:
  1364.                  if(MENUNUM(im->Code)==1)
  1365.                  {
  1366.                    i=Button; Button=0;
  1367.                    HandleEditGadget(NULL,GAD_SysopLogin+ITEMNUM(im->Code));
  1368.                    HandleEditGadget(NULL,GAD_Node_0+SUBNUM(im->Code));
  1369.                    Button=i;
  1370.                  }
  1371.                  if(MENUNUM(im->Code)==2)
  1372.                  {
  1373.                    num=ITEMNUM(im->Code);
  1374.                    i=Button; Button=1;
  1375.                    HandleEditGadget(NULL,GAD_SysopLogin+BM[num]);
  1376.                    if(Buttons[BM[num]].Type)HandleEditGadget(NULL,GAD_Node_0+SUBNUM(im->Code));
  1377.                    Button=i;
  1378.                  }
  1379.                     
  1380.             default:
  1381.               break;
  1382.             }
  1383.             GT_ReplyIMsg(im);
  1384.           }
  1385.           CheckMasterSig(signals);
  1386.           if(signals&myappsig)
  1387.           {
  1388.             while(appmsg=(struct AppMessage *)GetMsg(myappport))ReplyMsg((struct Message *)appmsg);          
  1389.             ZipWindow(EWin);//ChangeWindowBox(EWin,EdgeX,EdgeY,Width,Height);
  1390.           }  
  1391.         }
  1392.         ShutDownMaster();
  1393.         if(EWin->MenuStrip)
  1394.         {
  1395.             ClearMenuStrip(EWin);
  1396.             MaddRem();
  1397.         }
  1398.        
  1399.        CloseWindow(EWin);
  1400.       }
  1401.     }
  1402.     FreeGads();
  1403.     if(PublicName[0]!='\0')
  1404.     {
  1405.       if(Scr=LockPubScreen(PublicName))
  1406.       {
  1407.         Forbid();
  1408.         UnlockPubScreen(NULL,Scr);
  1409.         CloseScreen(Scr);
  1410.         Permit();
  1411.       }
  1412.     }
  1413.    }
  1414.   
  1415.   
  1416.   FreeMem(msg,sizeof(struct ACPMessage));
  1417.   
  1418. TheEnd:
  1419.   if(DoMultiCom)ShutDownSemis();
  1420.   for(i=0;i<10;i++)
  1421.   {
  1422.     if(Cmds[i]!=NULL)
  1423.       FreeMem(Cmds[i],sizeof(struct Commands));
  1424.     if(Sopt[i]!=NULL)
  1425.       FreeMem(Sopt[i],sizeof(struct StartOption));
  1426.   }
  1427.   }else  myrequest("ACP is already running.");
  1428.  
  1429.   CloseLibrary((struct Library *)GfxBase);
  1430.   CloseLibrary(IconBase);
  1431.   CloseLibrary((struct Library *)GadToolsBase);
  1432.   CloseLibrary((struct Library *)IntuitionBase);
  1433.   if(argc!=0) exit(0);
  1434.   
  1435.  
  1436. void CheckMasterSig(long signals)
  1437. {
  1438.    char temp[100], temp1[10];int i;
  1439.    if(signals&&MasterSig)
  1440.    {
  1441.    while((cpymsg=(struct ACPMessage *)GetMsg((struct MsgPort *)mp)))             
  1442.    {
  1443.      if(cpymsg->Command==SV_START)
  1444.      {
  1445.        strcpy(cpymsg->User,mybbslocation);
  1446.        cpymsg->Cmds=(struct Commands *)Cmds[cpymsg->Node];
  1447.        cpymsg->Sopt=(struct StartOption *)Sopt[cpymsg->Node];
  1448.      }
  1449.      CopyMem(cpymsg,msg,sizeof(struct ACPMessage));
  1450.      ReplyMsg((struct Message *)cpymsg);
  1451.      switch(msg->Command)
  1452.      {
  1453.        case JH_UPDATE:
  1454.             UpdateNode(msg->User,msg->Location,msg->Action,msg->Baud,msg->Node);
  1455.             if(ShowAbout) { ShowNodes(); ShowAbout=0; }
  1456.             break;
  1457.        case JH_DOWNLOAD:
  1458.             RegLastDownloads(msg->User,msg->Node);
  1459.             sprintf(temp,"DL: %s",msg->User); sprintf(temp1,"%d",SV_NEWMSG);
  1460.             UpdateNode(temp,msg->Location,temp1,msg->Baud,msg->Node);
  1461.             if(ShowAbout) { ShowNodes(); ShowAbout=0;}
  1462.             break;
  1463.        case JH_UPLOAD:
  1464.             RegLastUploads(msg->User,msg->Node);
  1465.             sprintf(temp,"UL: %s",msg->User); sprintf(temp1,"%d",SV_NEWMSG);
  1466.             UpdateNode(temp,msg->Location,temp1,msg->Baud,msg->Node);
  1467.           
  1468.             if(ShowAbout) { ShowNodes(); ShowAbout=0;}
  1469.             break;
  1470.        case JH_CHATON: TChat[msg->Node]=1;
  1471.             SetAPen(EWin->RPort,TChat[msg->Node]);
  1472.                     Move(EWin->RPort,64,26+(msg->Node*11));
  1473.                     Draw(EWin->RPort,64,26+(msg->Node*11)+6);
  1474.                     Move(EWin->RPort,63,26+(msg->Node*11));
  1475.                     Draw(EWin->RPort,63,26+(msg->Node*11)+6);
  1476.                     Move(EWin->RPort,62,26+(msg->Node*11));
  1477.                     Draw(EWin->RPort,62,26+(msg->Node*11)+6);
  1478.                     Move(EWin->RPort,61,26+(msg->Node*11));
  1479.                     Draw(EWin->RPort,61,26+(msg->Node*11)+6); 
  1480.             break;
  1481.        case JH_CHATOFF: TChat[msg->Node]=0;
  1482.             SetAPen(EWin->RPort,TChat[msg->Node]);
  1483.                     Move(EWin->RPort,64,26+(msg->Node*11));
  1484.                     Draw(EWin->RPort,64,26+(msg->Node*11)+6);
  1485.                     Move(EWin->RPort,63,26+(msg->Node*11));
  1486.                     Draw(EWin->RPort,63,26+(msg->Node*11)+6);
  1487.                     Move(EWin->RPort,62,26+(msg->Node*11));
  1488.                     Draw(EWin->RPort,62,26+(msg->Node*11)+6);
  1489.                     Move(EWin->RPort,61,26+(msg->Node*11));
  1490.                     Draw(EWin->RPort,61,26+(msg->Node*11)+6); 
  1491.             break;
  1492.        case JH_QUIETON: QuietNode[msg->Node]=1; 
  1493.             ShowQuiet(msg->Node); break;
  1494.        case JH_QUIETOFF: QuietNode[msg->Node]=0; ShowQuiet(msg->Node); break;
  1495.        case JH_AUTOCOMMAND:
  1496.             i=Button;
  1497.             if(msg->Data<20)
  1498.             {
  1499.                Button=0; Control=0;
  1500.                if(msg->Data >=0)HandleEditGadget(NULL,GAD_SysopLogin+msg->Data);
  1501.                HandleEditGadget(NULL,GAD_Node_0+msg->Node);
  1502.             }
  1503.             else
  1504.             {
  1505.                Button=1;
  1506.                msg->Data -=20; Control=0;
  1507.                HandleEditGadget(NULL,GAD_SysopLogin+BM[msg->Data]);
  1508.                  if(Buttons[BM[msg->Data]].Type)HandleEditGadget(NULL,GAD_Node_0+msg->Node);
  1509.             }
  1510.            Button=i;
  1511.            break;
  1512.      }
  1513.    }
  1514.    }
  1515.              
  1516. }
  1517.  
  1518. /* ***** Do BevelBorders ***** */
  1519. void
  1520. drawborders(void)
  1521. {
  1522. /* *** Stats *** */
  1523.   DrawBevelBox(EWin->RPort, BLEF_0, BTOP_0, BWID_0, BHEI_0 -110 +(Theight*11),
  1524.     GT_VisualInfo, VisInfo,
  1525.     TAG_END);
  1526. }
  1527.  
  1528. /* ***** Free the Gadlist and return ***** */
  1529. void
  1530. FreeGads(void)
  1531. {
  1532.   FreeGadgets(EGList);
  1533.   if (VisInfo)
  1534.     FreeVisualInfo(VisInfo);
  1535.   VisInfo = NULL;
  1536.   EGList  = NULL;
  1537. }
  1538.  
  1539. //*******************************************************************
  1540. // OpenMaster - This function opens a port for the nodes to interact
  1541. //********************************************************************
  1542. void OpenMaster(void)
  1543. {
  1544.   mp=(struct MsgPort *)CreatePort(PortName,0L);
  1545.   myappport=CreateMsgPort();
  1546. }
  1547.  
  1548. //*******************************************************************
  1549. //  ShutDownMaster - This function removes our Master port insuring
  1550. //  that there is no pending messages first
  1551. //*******************************************************************
  1552. void ShutDownMaster(void)
  1553. {
  1554.    while((cpymsg=(struct ACPMessage *)GetMsg((struct MsgPort *)mp)))             
  1555.    {
  1556.      CopyMem(cpymsg,msg,sizeof(struct ACPMessage));
  1557.      ReplyMsg((struct Message *)cpymsg);
  1558.    }
  1559.       DeletePort((struct MsgPort *)mp);
  1560.       DeletePort(myappport);
  1561. }
  1562.  
  1563. //*******************************************************************
  1564. // UpdateNode - This function determines what a user is doing based
  1565. // on input from the nodes. Then it updates the Node data
  1566. //*******************************************************************
  1567. void UpdateNode(char *name,char *location,char *action,char *baud,int node)
  1568. {
  1569.    char Action[50];
  1570.     strcpy(Action,"");
  1571.    switch(atoi(action))
  1572.    {
  1573.      case 0: strcpy(Action,"Idle            ");break;
  1574.      case 1: strcpy(Action,"Downloading     ");break;
  1575.      case 2: strcpy(Action,"Uploading       ");break;
  1576.      case 3: strcpy(Action,"Module          ");break;
  1577.      case 4: strcpy(Action,"Read/Write  Mail");break;
  1578.      case 5: strcpy(Action,"Reviewing Stats ");break;
  1579.      case 6: strcpy(Action,"Account Editing ");break;
  1580.      case 7: strcpy(Action,"Zooming Mail    ");break;
  1581.      case 8: strcpy(Action,"View Dir files  ");break;
  1582.      case 9: strcpy(Action,"Reading Bulletin");break;
  1583.      case 10:strcpy(Action,"Viewing a file  ");break;
  1584.      case 11:strcpy(Action,"Account Sequence");break;
  1585.      case 12:strcpy(Action,"Logging off     ");break;
  1586.      case 13:strcpy(Action,"Sysop Commands  ");break;
  1587.      case 14:strcpy(Action,"Dropped to Shell");break;
  1588.      case 15:strcpy(Action,"Using Emacs     ");break;
  1589.      case 16:strcpy(Action,"Joining a Conf. ");break;
  1590.      case 17:strcpy(Action,"Chatting        ");Chat[node]=1;break;
  1591.      case 18:strcpy(Action,"Reseting Node   ");break;
  1592.      case 19:strcpy(Action,"Requesting Chat ");Chat[node]=2;break;
  1593.      case 20:strcpy(Action,"Connecting      ");break;
  1594.      case 21:strcpy(Action,"Logging on      ");break;
  1595.      case 22:strcpy(Action,"Awaiting Connect");Chat[node]=1;break;
  1596.      case 23:strcpy(Action,"Scanning Mail   ");break;
  1597.      case 24:strcpy(Action,"Node Inactive   ");ActiveNodes -=1;
  1598.      /*if(ActiveNodes==0) notDone=0;*/break;
  1599.      case 25:strcpy(Action,"MultiNode Chat  ");break;
  1600.      case 26:strcpy(Action,"BBS Suspended   ");break;
  1601.      case 27:strcpy(Action,"Reserve for User");break;
  1602.      case SV_AESHELL:
  1603.              strcpy(Action,"Entered AEShell ");break;
  1604.      case SV_NEWMSG:
  1605.              strcpy(Action,name); break;
  1606.    }
  1607.    DrawPen=Chat[node];if(QuietNode[node]) DrawPen=3;
  1608.      SetAPen(EWin->RPort,DrawPen);
  1609.    if(atoi(action)!=SV_NEWMSG)
  1610.    {
  1611.       Move(EWin->RPort,69,32+(node*11));
  1612.       Text(EWin->RPort,"                              ",22);
  1613.       Move(EWin->RPort,253,32+(node*11));
  1614.       Text(EWin->RPort,"                              ",23);
  1615.    }
  1616.       Move(EWin->RPort,437,32+(node*11));
  1617.       Text(EWin->RPort,"                ",16);
  1618.    SetAPen(EWin->RPort,DrawPen);
  1619.     if(atoi(action)!=SV_NEWMSG)
  1620.     {
  1621.    Move(EWin->RPort,69,32+(node*11));
  1622.    Text(EWin->RPort,name,strlen(name)>22?22:strlen(name));
  1623.    Move(EWin->RPort,255,32+(node*11));
  1624.    Text(EWin->RPort,location,strlen(location)>22?22:strlen(location));
  1625.    Move(EWin->RPort,580,32+(node*11));
  1626.    Text(EWin->RPort,baud,5);
  1627.    }
  1628.    Move(EWin->RPort,439,32+(node*11));
  1629.  
  1630.  if(atoi(action)==26) suspend[node]=1; else suspend[node]=0;
  1631.  Text(EWin->RPort,Action,strlen(Action)>16?16:strlen(Action));
  1632.  if(atoi(action)!=SV_NEWMSG)
  1633.  {
  1634.   strcpy(Users[node].User,name);
  1635.   strcpy(Users[node].Location,location);
  1636.  }
  1637.  strcpy(Users[node].Action,Action);
  1638.  strcpy(Users[node].Baud,baud);
  1639.  Users[node].Active=1;
  1640.  if(atoi(action)==27) Users[node].action=22; else Users[node].action=atoi(action);
  1641.  if(Users[node].action==21){ RegLastUser(Users[node].User,node); 
  1642.    switch(TopOption)
  1643.    {
  1644.      case LAST_CALLERS:ShowLastUser(EWin);break;
  1645.      case LAST_UPLOADS:ShowLastUploads(EWin);break;
  1646.      case LAST_DOWNLOADS:ShowLastDownloads(EWin);break;
  1647.    } }
  1648.   
  1649.    
  1650. }
  1651.  
  1652. //***********************************************************************
  1653. // HandleEditGadget - This function determines what actions should take
  1654. // place when a gadget is selected from the ACP screen
  1655. //***********************************************************************
  1656. void HandleEditGadget(IMsg *im,short ig)
  1657. {
  1658.    short id;
  1659.    if(im!=NULL)
  1660.    id = ((Gadget *)im->IAddress)->GadgetID;
  1661.    else id=ig;
  1662.    switch(id)
  1663.    {
  1664.      case GAD_Node_0:if(suspend[0] && ButtonID<0) break;if(Control || ButtonID>=0) DoControl(0); else CallNode(0,SV_UNICONIFY); break;
  1665.      case GAD_Node_1:if(suspend[1] && ButtonID<0) break;if(Control || ButtonID>=0) DoControl(1); else CallNode(1,SV_UNICONIFY); break;
  1666.      case GAD_Node_2:if(suspend[2] && ButtonID<0) break;if(Control || ButtonID>=0) DoControl(2); else CallNode(2,SV_UNICONIFY); break;
  1667.      case GAD_Node_3:if(suspend[3] && ButtonID<0) break;if(Control || ButtonID>=0) DoControl(3); else CallNode(3,SV_UNICONIFY); break;
  1668.      case GAD_Node_4:if(suspend[4] && ButtonID<0) break;if(Control || ButtonID>=0) DoControl(4); else CallNode(4,SV_UNICONIFY); break;
  1669.      case GAD_Node_5:if(suspend[5] && ButtonID<0) break;if(Control || ButtonID>=0) DoControl(5); else CallNode(5,SV_UNICONIFY); break;
  1670.      case GAD_Node_6:if(suspend[6] && ButtonID<0) break;if(Control || ButtonID>=0) DoControl(6); else CallNode(6,SV_UNICONIFY); break;
  1671.      case GAD_Node_7:if(suspend[7] && ButtonID<0) break;if(Control || ButtonID>=0) DoControl(7); else CallNode(7,SV_UNICONIFY); break;
  1672.      case GAD_Node_8:if(suspend[8] && ButtonID<0) break;if(Control || ButtonID>=0) DoControl(8); else CallNode(8,SV_UNICONIFY); break;
  1673.      case GAD_Node_9:if(suspend[9] && ButtonID<0) break;if(Control || ButtonID>=0) DoControl(9); else CallNode(9,SV_UNICONIFY); break;
  1674.     case GAD_NRAMS:
  1675.          if(Button){ if(!Nutton(14))DoButton(14,0); break;}
  1676.          if(Control) Control=0; else Control=SV_SETNRAMS;
  1677.          break;
  1678.     case GAD_SaveWin:
  1679.          if(Button){ if(!Nutton(13))DoButton(13,0); break;}
  1680.          ScreenSave(); break;
  1681.     case GAD_NodeConfig:
  1682.          if(Button){ if(!Nutton(11))DoButton(11,0); break;}
  1683.          if(Control) Control=0; else Control=NODECONFIG; break;
  1684.     case GAD_MCP: 
  1685.          if(Button){ if(!Nutton(10))DoButton(10,0); break; }
  1686.          if(Control) Control=0; else Control=SV_QUIETNODE;
  1687.          break;
  1688.     case GAD_SysopLogin:
  1689.          if(Button){ if(!Nutton(0))DoButton(0,0); break; }
  1690.          if(Control) Control=0; else Control=SV_SYSOPLOG; break;
  1691.     case GAD_LocalLogin:
  1692.          if(Button){ if(!Nutton(5))DoButton(5,0); break;}
  1693.          if(Control) Control=0; else Control=SV_LOCALLOG; break;
  1694.     case GAD_Accounts:
  1695.          if(Button){ if(!Nutton(7))DoButton(7,0); break;}
  1696.          if(Control) Control=0; else Control=SV_ACCOUNTS; break;
  1697.     case GAD_NodeChat:
  1698.          if(Button){ if(!Nutton(12))DoButton(12,0); break;}
  1699.          if(Control) Control=0; else Control=SV_CHAT; break;
  1700.     case GAD_ExitNode:
  1701.          if(Button){ if(!Nutton(4))DoButton(4,0); break; }
  1702.          if(Control) Control=0; else Control=SV_EXITNODE; break;
  1703.     case GAD_NodeOffHook:
  1704.          if(Button){ if(!Nutton(9))DoButton(9,0); break; }
  1705.          if(Control) Control=0; else Control=SV_NODEOFFHOOK; break;
  1706.     case GAD_InitModem:
  1707.          if(Button){ if(!Nutton(8))DoButton(8,0); break;}
  1708.          if(Control) Control=0; else Control=SV_INITMODEM; break;
  1709.     case GAD_InstantLogin:
  1710.          if(Button){ if(!Nutton(1))DoButton(1,0); break;}
  1711.          if(Control) Control=0; else Control=SV_INSTANT; break;
  1712.     case GAD_ReserveNode:
  1713.          if(Button){ if(!Nutton(6))DoButton(6,0); break; }
  1714.          if(Control) Control=0;else Control=SV_RESERVE; break;
  1715.     case GAD_Short:
  1716.          shorten=1;
  1717.          if(!ShortUp)
  1718.          {
  1719.            
  1720.            if(!Short) 
  1721.            { 
  1722.  
  1723.             SizeWindow(EWin,0,-63);
  1724.             MoveWindow(EWin,0,63);
  1725.             Short=1;
  1726.            }
  1727.            else {
  1728.            Short=0;MoveWindow(EWin,0,-63);SizeWindow(EWin,0,63);
  1729.            }
  1730.          }
  1731.          else
  1732.          {
  1733.            if(!Short)
  1734.            {
  1735.              SizeWindow(EWin,0,-63);
  1736.              Short=1;
  1737.            }
  1738.            else
  1739.            {
  1740.              Short=0; SizeWindow(EWin,0,63);
  1741.            }
  1742.          }
  1743.          break;
  1744.     case GAD_AEShell:
  1745.          if(Button){ if(!Nutton(2))DoButton(2,0); break; }
  1746.          if(Control) Control=0;else Control=SV_AESHELL; break;  
  1747.     case GAD_ToggleChat:
  1748.          if(Button){ if(!Nutton(3))DoButton(3,0); break; }
  1749.          if(Control) Control=0;else Control=SV_CHATTOGGLE; break;
  1750.     case GAD_Tops: TopOption++; if(TopOption>2) TopOption=0; 
  1751.          switch(TopOption)
  1752.          {
  1753.            case LAST_CALLERS: ShowLastUser(EWin);break;
  1754.            case LAST_DOWNLOADS: ShowLastDownloads(EWin); break;
  1755.            case LAST_UPLOADS: ShowLastUploads(EWin);break;
  1756.          }break;
  1757.     case GAD_TopsBox:
  1758.          if(Control) { Control=0; 
  1759.          switch(TopOption)
  1760.          {
  1761.            case LAST_CALLERS:ShowLastUser(EWin); break;
  1762.            case LAST_UPLOADS:ShowLastUploads(EWin); break;
  1763.            case LAST_DOWNLOADS:ShowLastDownloads(EWin);
  1764.          }}else Control=SV_TOPS; break;
  1765.     case GAD_Control:
  1766.          ToggleGads(); break;
  1767.    }
  1768. }
  1769.  
  1770. //*********************************************************************
  1771. // DoButton - Determines if the button is a NUTTON and acts accordingly
  1772. //*********************************************************************
  1773. void DoButton(int B,int node)
  1774. {
  1775.    char string[200];
  1776.    if(Buttons[B].Type)
  1777.    {
  1778.      sprintf(string,"%s %d",Buttons[B].Command,node);
  1779.      Execute(string,NULL,NULL);
  1780.      ButtonID=-1; //tells us that there is no custom buttons pending
  1781.      return;
  1782.    }     
  1783.    Execute(Buttons[B].Command,NULL,NULL);
  1784. }
  1785.  
  1786. //*********************************************************************
  1787. // Nutton - This determines what type of custom button was seleced
  1788. // returns 1 if it is a Nutton otherwise it retunes a 0
  1789. //*********************************************************************
  1790. int Nutton(int B)
  1791. {
  1792.   if(Buttons[B].Type)
  1793.   {
  1794.     ButtonID=B; return(1);
  1795.   }
  1796.   return(0);
  1797. }
  1798. struct ScreenPref
  1799. {
  1800.   SHORT Left;
  1801.   SHORT Top;
  1802.   SHORT Width;
  1803.   SHORT Height;
  1804.   SHORT Nodes;
  1805.   //WORD Zoom[5];
  1806. } Pref;
  1807.  
  1808. void LoadScreen(void)
  1809. {
  1810.   BPTR fi;
  1811.   register int i;
  1812.   register int nodes=0;
  1813.   fi=Open("S:ACP.config",MODE_OLDFILE);
  1814.   if(fi==NULL) return;
  1815.   FRead(fi,(APTR)&Pref,sizeof(struct ScreenPref),1);
  1816.   Close(fi);
  1817.   for(i=0;i<9;i++) { if(Nodes[i]) nodes++; }
  1818.   if(Pref.Nodes!=nodes) return;
  1819.   EdgeX=Pref.Left;
  1820.   EdgeY=Pref.Top;
  1821.   Width=Pref.Width;
  1822.   Height=Pref.Height;
  1823.  
  1824.   //DIM[0]=Pref.Zoom[0];
  1825.   //DIM[1]=Pref.Zoom[1];
  1826.   //DIM[2]=Pref.Zoom[2];
  1827.   //DIM[3]=Pref.Zoom[3];
  1828.  
  1829.  
  1830. }
  1831.  
  1832. void ScreenSave(void)
  1833. {
  1834.   BPTR fi;
  1835.   register int i;
  1836.   register int nodes=0;
  1837.   Pref.Top=EWin->TopEdge;
  1838.   Pref.Left=EWin->LeftEdge;
  1839.   Pref.Height=EWin->Height;
  1840.   Pref.Width=EWin->Width;
  1841.   for(i=0;i<9;i++){ if(Nodes[i]) nodes++; }
  1842.   Pref.Nodes=nodes;
  1843.   //Pref.Zoom[0]=DIM[0];
  1844.   //Pref.Zoom[1]=DIM[1];
  1845.   //Pref.Zoom[2]=DIM[2];
  1846.   //Pref.Zoom[3]=DIM[3];
  1847.   fi=Open("S:ACP.config",MODE_NEWFILE);
  1848.   Write(fi,(APTR)&Pref,sizeof(struct ScreenPref));
  1849.   Close(fi);
  1850.  
  1851. }
  1852.  
  1853. //*********************************************************************
  1854. // CallNode - This function opens a port to a nodes AEServer and tries
  1855. // to send a msg to the node and waits on a reply
  1856. //*********************************************************************
  1857. void CallNode(int node,int Code)
  1858. {
  1859.    char Response[100];
  1860.    sprintf(Response,"AmiExpress_Node.%d",node);
  1861.    if(!FindPort(Response))
  1862.    {
  1863.      if(StartNode[node][0]!='\0')
  1864.      {
  1865.        //ActiveNodes +=1; Down[node]=FALSE;
  1866.        if(StartProcess(&StartNode[node],BBSStack)) { ActiveNodes +=1; Down[node]=FALSE; }
  1867.        //Execute(StartNode[node],NULL,NULL);
  1868.        return;
  1869.      }
  1870.    }
  1871.    if(Register(node))
  1872.    {
  1873.       getuserstring(Response,Code);
  1874.    }
  1875. }      
  1876.  
  1877. //*********************************************************************
  1878. // ShowNodes - This function will refresh the node activity portion of
  1879. // the window
  1880. //*********************************************************************
  1881. void ShowNodes(void)
  1882. {
  1883.   register int i;
  1884.   for(i=0;i<Theight;i++)
  1885.   {
  1886.      if(QuietNode[i]) SetAPen(EWin->RPort,3);
  1887.      else SetAPen(EWin->RPort,1);
  1888.      Move(EWin->RPort,69,32+(i*11)) ;
  1889.      Text(EWin->RPort,Blank,strlen(Blank));
  1890.      
  1891.      if(Users[i].Active)
  1892.      {
  1893.        Move(EWin->RPort,69,32+(i*11));
  1894.  
  1895. Text(EWin->RPort,Users[i].User,strlen(Users[i].User)>22?22:strlen(Users[i].User));
  1896.        Move(EWin->RPort,255,32+(i*11));
  1897.  
  1898. Text(EWin->RPort,Users[i].Location,strlen(Users[i].Location)>22?22:strlen(Users[i].Location));
  1899.        Move(EWin->RPort,439,32+(i*11));
  1900.  
  1901. Text(EWin->RPort,Users[i].Action,strlen(Users[i].Action)>16?16:strlen(Users[i].Action));
  1902.   
  1903.        Move(EWin->RPort,580,32+(i*11));
  1904. Text(EWin->RPort,Users[i].Baud,5);
  1905.  
  1906.      }   
  1907.   }
  1908. }
  1909.  
  1910. //*********************************************************************
  1911. // ClearUsers - initialize all the User storage
  1912. //*********************************************************************
  1913. void ClearUsers(void)
  1914. {
  1915.   register int i;
  1916.   for(i=0;i<9;i++)
  1917.   {
  1918.      strcpy(Users[i].User,"");
  1919.      strcpy(Users[i].Location,"");
  1920.      strcpy(Users[i].Action,"");
  1921.      strcpy(Users[i].Baud,"     ");
  1922.      Users[i].Active=0;
  1923.   }
  1924. }
  1925.  
  1926. //********************************************************************
  1927. // DoControl - executes the buttons
  1928. //********************************************************************
  1929. void DoControl(int node)
  1930. {
  1931.   char cmd[200]; /*** temporary storage for misc ***/
  1932.   int cd; /*** stores the current node action ***/
  1933.   if(ButtonID>=0 && Button)
  1934.   {
  1935.      DoButton(ButtonID,node);
  1936.      return;
  1937.   }
  1938.   switch(Control)
  1939.   {
  1940.     case NODECONFIG:
  1941.          GetIconNodeInfo(node); break;
  1942.  
  1943.     case RUNMCP:
  1944.          sprintf(cmd,"run >nil: bbs:utils/mcp.script");
  1945.          Execute(cmd,NULL,NULL); break;
  1946.     case SV_SETNRAMS:
  1947.      if(Users[node].action==22){ CallNode(node,SV_SETNRAMS);}
  1948.      else DisplayBeep(Scr); break;
  1949.     case SV_SYSOPLOG:
  1950.      if(Users[node].action==22){ CallNode(node,SV_SYSOPLOG);}
  1951.      else DisplayBeep(Scr);break;
  1952.     case SV_LOCALLOG:
  1953.      if(Users[node].action==22){ CallNode(node,SV_LOCALLOG);}
  1954.      else DisplayBeep(Scr);break;
  1955.     case SV_ACCOUNTS:
  1956.      if(Users[node].action==22){ CallNode(node,SV_ACCOUNTS);}
  1957.      else DisplayBeep(Scr);break;
  1958.     case SV_EXITNODE:
  1959.      if(Users[node].action==22){ CallNode(node,SV_EXITNODE); }
  1960.      else DisplayBeep(Scr);break;
  1961.     case SV_NODEOFFHOOK:
  1962.      if(Users[node].action==22){ CallNode(node,SV_NODEOFFHOOK);}
  1963.      else DisplayBeep(Scr);break;
  1964.     case SV_RESERVE:
  1965.      if(Users[node].action==22){ CallNode(node,SV_RESERVE); }
  1966.      else DisplayBeep(Scr); break;
  1967.     case SV_CHAT: cd=Users[node].action;
  1968.      if(cd!=26 && cd!=1 && cd!=2 && cd!=11 && cd!=12 && cd!=15 && cd!=18 && cd!=20 &&
  1969.         cd!=21 && cd!=22 && cd!=24)
  1970.      { CallNode(node,SV_CHAT);}
  1971.      else DisplayBeep(Scr); break;
  1972.     case SV_INITMODEM:
  1973.      if(Users[node].action==22){ CallNode(node,SV_INITMODEM); } 
  1974.      else DisplayBeep(Scr);break;
  1975.     case SV_INSTANT:
  1976.      if(Users[node].action==22){ CallNode(node,SV_INSTANT); }
  1977.      else DisplayBeep(Scr); break;
  1978.     case SV_AESHELL:
  1979.      if(Users[node].action==22){ 
  1980.                                  CallNode(node,SV_AESHELL);
  1981.                                } else DisplayBeep(Scr); break;
  1982.     case SV_CHATTOGGLE: cd=Users[node].action;
  1983.       if(cd!=24 && cd!=26)
  1984.       {
  1985.        /* if(TChat[node]) TChat[node]=0; else TChat[node]=1;
  1986.         SetAPen(EWin->RPort,TChat[node]);
  1987.         Move(EWin->RPort,64,26+(node*11));
  1988.         Draw(EWin->RPort,64,26+(node*11)+6);
  1989.         Move(EWin->RPort,63,26+(node*11));
  1990.         Draw(EWin->RPort,63,26+(node*11)+6);
  1991.         Move(EWin->RPort,62,26+(node*11));
  1992.         Draw(EWin->RPort,62,26+(node*11)+6);
  1993.         Move(EWin->RPort,61,26+(node*11));
  1994.         Draw(EWin->RPort,61,26+(node*11)+6);*/
  1995.         CallNode(node,SV_CHATTOGGLE); break;
  1996.       }else DisplayBeep(Scr);
  1997.         break;
  1998.     case SV_QUIETNODE: cd=Users[node].action;
  1999.          if(cd!=24 && cd!=26)CallNode(node,SV_QUIETNODE);
  2000.          else DisplayBeep(Scr); break;
  2001.     case SV_TOPS:
  2002.       switch(TopOption)
  2003.       {
  2004.         case LAST_CALLERS:ShowNdLastUser(EWin,node);break;
  2005.         case LAST_UPLOADS:ShowNdLastUploads(EWin,node);break;
  2006.         case LAST_DOWNLOADS:ShowNdLastDownloads(EWin,node);break;
  2007.       } break;
  2008.    }
  2009.   Control = 0;
  2010. }
  2011.  
  2012. struct PSTR
  2013. {
  2014.   int s1;
  2015.   int s2;
  2016.   int ns;
  2017.   int ne;
  2018. };
  2019.  
  2020.  
  2021.  
  2022. void ReadStartUp(char *s)
  2023. {
  2024.   char image[200];
  2025.   struct DiskObject *dobj;
  2026.   char **oldtooltypes;
  2027.   char *t;
  2028.   struct PSTR p;
  2029.   register int i;
  2030.   int nodes;
  2031.   int buttonnum=0;
  2032.   int buttontitle=0;
  2033.   int j;
  2034.   for(i=0;i<9;i++)
  2035.   {
  2036.     strcpy(StartNode[i],"");
  2037.     NodeIdle[i]=0;
  2038.   }
  2039.   for(i=0;i<17;i++)
  2040.   {
  2041.     strcpy(Buttons[i].Text,"");
  2042.     strcpy(Buttons[i].Command,"");
  2043.   }
  2044.   
  2045.  
  2046.   dobj=GetDiskObject(s);
  2047.   if(dobj==NULL) 
  2048.   { 
  2049.      myrequest("Error, can't locate acp.info"); ACPError=1; return; }
  2050.     oldtooltypes=dobj->do_ToolTypes;
  2051.      if(FindToolType(oldtooltypes,"MULTICOM_PORT")) { DoMultiCom=1; CreateSemaphores(); }
  2052.     if(t=FindToolType(oldtooltypes,"PUBLICSCREEN")) strcpy(PublicName,t);
  2053.     if(t=FindToolType(oldtooltypes,"NODES")) 
  2054.     {
  2055.         j=0; nodes=atoi(t);
  2056.       while(j<nodes)
  2057.       { GetCmds(j);if(Theight<j) Theight=j;Nodes[j]=1;Cmds[j]->AcLvl[NODE_NUMBER]=j; j++;}
  2058.     }
  2059.     else { FreeDiskObject(dobj); myrequest("ERROR, missing NODES tooltype\nPlease refer to /X documentation");ACPError=1; return; }
  2060.     if(t=FindToolType(oldtooltypes,"ICONIFIED")) ZipOn=TRUE;
  2061.     if(t=FindToolType(oldtooltypes,"ICONIFY.LEFTEDGE")) ZIM[0]=atoi(t);
  2062.     if(t=FindToolType(oldtooltypes,"ICONIFY.TOPEDGE")) ZIM[1]=atoi(t);
  2063.     if(t=FindToolType(oldtooltypes,"SHORT_DONOTMOVE")) ShortUp=1;
  2064. if(t=FindToolType(oldtooltypes,"PRIORITY")) SetTaskPri(FindTask(0),atoi(t));
  2065.     
  2066.       j=1;
  2067.       sprintf(image,"BACKUP.%d",j++);
  2068.       while(t=FindToolType(oldtooltypes,image))
  2069.       {
  2070.          Backup(t,5);
  2071.          sprintf(image,"BACKUP.%d",j++);
  2072.       }
  2073.       j=1;
  2074.       sprintf(image,"RESTRICT.%d",j++);
  2075.       while(t=FindToolType(oldtooltypes,image))
  2076.       {
  2077.          Restrict(t);
  2078.          sprintf(image,"RESTRICT.%d",j++);
  2079.       }
  2080.       j=1;
  2081.       sprintf(image,"BUTTON_NAME.%d",j++);
  2082.       while(t=FindToolType(oldtooltypes,image))
  2083.       {
  2084.          strcpy(Buttons[buttonnum++].Text,t);
  2085.          sprintf(image,"BUTTON_NAME.%d",j++);
  2086.       }
  2087.       j=1;
  2088.       sprintf(image,"BUTTON_COMMAND.%d",j++);
  2089.       while(t=FindToolType(oldtooltypes,image))
  2090.       {
  2091.          strcpy(Buttons[buttontitle++].Command,t);
  2092.          sprintf(image,"BUTTON_COMMAND.%d",j++);
  2093.       }
  2094.       j=1;
  2095.       sprintf(image,"NUTTON_NAME.%d",j++);
  2096.       while(t=FindToolType(oldtooltypes,image))
  2097.       {
  2098.          strcpy(Buttons[buttonnum++].Text,t);
  2099.          sprintf(image,"NUTTON_NAME.%d",j++);
  2100.       }
  2101.       j=1;
  2102.       sprintf(image,"NUTTON_COMMAND.%d",j++);
  2103.       while(t=FindToolType(oldtooltypes,image))
  2104.       {
  2105.          strcpy(Buttons[buttontitle].Command,t);
  2106.          Buttons[buttontitle++].Type=TRUE;
  2107.          sprintf(image,"NUTTON_COMMAND.%d",j++);
  2108.          
  2109.       }
  2110.       BBSStack=50000L;
  2111.       if(t=FindToolType(oldtooltypes,"BBS_STACK")) BBSStack=(ULONG)atol(t);
  2112.       if(t=FindToolType(oldtooltypes,"BBS_NAME")) { for(i=0;i<nodes;i++)strcpy(Cmds[i]->BBSName,t); }                 
  2113.       if(t=FindToolType(oldtooltypes,"BBS_GEOGRAPHIC")) strcpy(mybbslocation,t);
  2114.       if(t=FindToolType(oldtooltypes,"BBS_LOCATION")) { for(i=0;i<nodes;i++)strcpy(Cmds[i]->BBSLoc,t); }
  2115.       else { myrequest("ERROR, missing BBS_LOCATION tooltype\nWait for all Disk Activity to Complete\nand reset"); }
  2116.       if(t=FindToolType(oldtooltypes,"SYSOP_NAME")) { for(i=0;i<nodes;i++) strcpy(Cmds[i]->SysopName,t); }
  2117.       if(t=FindToolType(oldtooltypes,"NEW_ACCOUNTS"))
  2118.       {
  2119.         if(MatchToolValue(t,"APPEND"))
  2120.         {
  2121.           for(i=0;i<nodes;i++) Sopt[i]->Toggles[13]=0; }
  2122.       }
  2123.  
  2124.       FreeDiskObject(dobj);
  2125.       if(DoMultiCom)
  2126.         for(i=0;i<nodes;i++) Sopt[i]->Toggles[10]=1;
  2127.  
  2128. CreateCustomMenus(nodes);
  2129. for(i=0;i<nodes;i++) GetIconNodeInfo(i);
  2130. GetIconBBSInfo(nodes);
  2131. }
  2132.  
  2133.  
  2134.   
  2135. void sr(char *str)
  2136. {
  2137.   register int i;
  2138.   i=strlen(str)-1;
  2139.   while(i)
  2140.   {
  2141.     if(*(str+i)<=32) *(str+i)='\0'; else break;
  2142.     i--;
  2143.   }
  2144. }
  2145.  
  2146. void SetTheGads(void)
  2147. {
  2148.   register int i; 
  2149.   static int j=0;
  2150.   static BOOL Set=FALSE;
  2151.   if(!j)
  2152.  {
  2153. strcpy(SetOriText[0],"Sysop Login");
  2154. strcpy(SetOriText[1],"Instant Login");
  2155. strcpy(SetOriText[2],"AEShell");
  2156. strcpy(SetOriText[3],"Toggle Chat");
  2157. strcpy(SetOriText[4],"Exit Node");
  2158. strcpy(SetOriText[5],"Local Login");
  2159. strcpy(SetOriText[6],"Reserve Node");
  2160. strcpy(SetOriText[7],"Accounts");
  2161. strcpy(SetOriText[8],"Init Modem");
  2162. strcpy(SetOriText[9],"Node(offhook)");
  2163. strcpy(SetOriText[10],"Quiet Node");
  2164. strcpy(SetOriText[11],"Config Node");
  2165. strcpy(SetOriText[12],"Node Chat");
  2166. strcpy(SetOriText[13],"Save Win");
  2167. strcpy(SetOriText[14],"Set NRAMS");
  2168.     j=1;
  2169.     return;
  2170.   }
  2171.   
  2172.   for(i=0;i<15;i++) // was 14
  2173.   {
  2174.     if(!Set){NGAry[i].ng_GadgetText=(STRPTR)&Buttons[i].Text; Button=1;}
  2175.  
  2176.     else { Button=0; ButtonID=-1; NGAry[i].ng_GadgetText=(STRPTR)&SetOriText[i];}
  2177.   }
  2178.   if(Set) Set=FALSE; else Set=TRUE;
  2179. }
  2180.  
  2181. void ToggleGads(void)
  2182. {
  2183.                      RemoveGList(EWin,gadgets,-1);                     
  2184.                      FreeGadgets(gadgets);
  2185.                      SetTheGads();
  2186.                      
  2187.                      gadgets=InitGads(Scr);
  2188.                      AddGList (EWin, gadgets, -1, -1, NULL);
  2189.                      
  2190.                      RefreshGList(Gad_ExitNode, EWin, NULL, (UWORD)15);
  2191.                      GT_RefreshWindow (EWin, NULL);
  2192.  /*switch(TopOption)
  2193.                 {
  2194.                   case LAST_CALLERS:ShowLastUser(EWin);break;
  2195.                   case LAST_UPLOADS:ShowLastUploads(EWin);break;
  2196.                   case LAST_DOWNLOADS:ShowLastDownloads(EWin);break;
  2197.                 }
  2198.  */
  2199. }
  2200.  
  2201. void GetCmds(int i)
  2202. {
  2203.   int j;
  2204.   extern struct MultiPort *SemiNodes;
  2205.   Cmds[i]=(struct Commands *)AllocMem(sizeof(struct Commands),MEMF_PUBLIC|MEMF_CLEAR);
  2206.   Sopt[i]=(struct StartOption *)AllocMem(sizeof(struct StartOption),MEMF_PUBLIC|MEMF_CLEAR);
  2207.   Sopt[i]->LeftEdge=0;
  2208.   Sopt[i]->TopEdge=0;
  2209.   Sopt[i]->Width=640;
  2210.   Sopt[i]->Height=200;
  2211.   Sopt[i]->BitPlanes=3;
  2212.   Sopt[i]->StatBar=FALSE;
  2213.   Sopt[i]->Interlace=FALSE;
  2214.   Sopt[i]->DupeCheck=FALSE;
  2215.   Sopt[i]->QLogon=FALSE;
  2216.   Sopt[i]->TakeCredits=FALSE;
  2217.   Sopt[i]->SeenIt=FALSE;
  2218.   Sopt[i]->TrapDoor=FALSE;
  2219.   Sopt[i]->Iconify=FALSE;
  2220.   Sopt[i]->RadBoogie=255;
  2221.   Sopt[i]->A2232=FALSE;
  2222. for(j=0;j<19;j++)
  2223.   {
  2224.     Sopt[i]->Toggles[j]=FALSE; }
  2225.     Sopt[i]->Toggles[13]=1;
  2226.   if(DoMultiCom)
  2227.   {
  2228.     ObtainSemaphore((struct SignalSemaphore *)SemiNodes);
  2229.   Sopt[i]->MasterSemi=SemiNodes;
  2230.   Sopt[i]->SingleSemi=SemiNodes->MyNode[i].s;
  2231.   ReleaseSemaphore((struct SignalSemaphore *)SemiNodes); Sopt[i]->Toggles[10]=TRUE;
  2232.   } else { Sopt[i]->MasterSemi=NULL; Sopt[i]->SingleSemi=NULL; }
  2233.  
  2234.   
  2235.   strcpy(Sopt[i]->CycleLock,"");
  2236.   strcpy(Sopt[i]->Logoff,"");
  2237.   strcpy(Sopt[i]->ShutDown,"");
  2238.   strcpy(Sopt[i]->RamPen,"");
  2239.   strcpy(Sopt[i]->BBSConfig,"");
  2240.   strcpy(Sopt[i]->FilesNot,"");
  2241.   strcpy(Sopt[i]->UserData,"");
  2242.   strcpy(Sopt[i]->UserKey,"");
  2243.   strcpy(Sopt[i]->OffHook,"");
  2244.   strcpy(Sopt[i]->PubScreen,"");
  2245. }
  2246.  
  2247. int Validate(void)
  2248. {
  2249.   register int i;
  2250.   for(i=0;i<10;i++)
  2251.   {
  2252.     if(Cmds[i]!=NULL)
  2253.     {
  2254.       if(Cmds[i]->AcLvl[DEFAULT_CHAT_ON]) TChat[i]=1;
  2255.     }
  2256.   }
  2257.     
  2258.   return(1);
  2259. }
  2260.      
  2261. #define ACCESS_READ -2
  2262. int TLock(char *str)
  2263. {
  2264.   long lock;
  2265.   if(lock=Lock(str,ACCESS_READ))
  2266.   {
  2267.     UnLock(lock); return(1);
  2268.   }
  2269.   return(0);
  2270. }
  2271.  
  2272. void strlim(char *str1,char *str2,int limit)
  2273. {
  2274.   register int i;
  2275.   if(strlen(str2)>limit)
  2276.   {
  2277.     ACPError=TRUE;
  2278.   }
  2279.   for(i=0;i<limit;i++)
  2280.   {
  2281.     if(*(str2)=='\0') break;
  2282.     *(str1+i)=*(str2+i);
  2283.   }
  2284. }
  2285.  
  2286. void strleft(char *str,char *str1)
  2287. {
  2288.    register int i=0,j=0;
  2289.    while(*(str1+i)==' ') i++;
  2290.    while(*(str1+i)!='\0'){ *(str+j)=*(str1+i); i++; j++; }
  2291.    *(str+j)='\0';
  2292. }
  2293. int atoileft(char str[])
  2294. {
  2295.   register int i=0;
  2296.   while(str[i]==' ') i++;
  2297.   return(atoi(&str[i]));
  2298. }
  2299.  
  2300. void ShowQuiet(int i)
  2301. {
  2302.    if(QuietNode[i]) SetAPen(EWin->RPort,3);
  2303.      else SetAPen(EWin->RPort,1);
  2304.      Move(EWin->RPort,69,32+(i*11)) ;
  2305.      Text(EWin->RPort,Blank,strlen(Blank));
  2306.        Move(EWin->RPort,69,32+(i*11));
  2307. Text(EWin->RPort,Users[i].User,strlen(Users[i].User)>22?22:strlen(Users[i].User));
  2308.        Move(EWin->RPort,255,32+(i*11));
  2309.  
  2310. Text(EWin->RPort,Users[i].Location,strlen(Users[i].Location)>22?22:strlen(Users[i].Location));
  2311.        Move(EWin->RPort,439,32+(i*11));
  2312.  
  2313. Text(EWin->RPort,Users[i].Action,strlen(Users[i].Action)>16?16:strlen(Users[i].Action));
  2314.        Move(EWin->RPort,580,32+(i*11));
  2315. Text(EWin->RPort,Users[i].Baud,5);
  2316. }    
  2317. #include "Restrict.h"
  2318. void LoadOldConfig(void)
  2319. {
  2320.   FILE *fi;
  2321.   register int i;
  2322.   char FileName[200];
  2323.   for(i=0;i<10;i++)
  2324.   {
  2325.     if(Cmds[i]!=NULL)
  2326.     {
  2327.       sprintf(FileName,"BBS:Config%d",i);
  2328.       fi=fopen(FileName,"rb");
  2329.       if(fi==NULL)
  2330.       {
  2331.         printf("Error, can't open %s\n",FileName);
  2332.         ACPError=TRUE;
  2333.       }
  2334.       else { fread((APTR)Cmds[i],sizeof(struct Commands),1,fi);fclose(fi);}
  2335.     }
  2336.   }
  2337. }
  2338.